Disable ksh built-in commands

Disable ksh built-in commands

am 25.09.2007 10:04:17 von Fabio

Hi all,
I'm looking for a procedure to disable built-in commands in ksh. I
would be interested to know how to do it for the kill command, so
that
users would use the command under /usr/bin and not the built-in
commnad.

Thanks for your help
Fabio

Re: Disable ksh built-in commands

am 25.09.2007 10:09:07 von Joachim Schmitz

"Fabio" schrieb im Newsbeitrag
news:1190707457.272413.312880@k79g2000hse.googlegroups.com.. .
> Hi all,
> I'm looking for a procedure to disable built-in commands in ksh. I
> would be interested to know how to do it for the kill command, so
> that
> users would use the command under /usr/bin and not the built-in
> commnad.
in /etc/profile, or better in the file mentiond in the variable ENV:
alias kill=/usr/bin/kill

Bye, Jojo

Re: Disable ksh built-in commands

am 25.09.2007 12:09:59 von Fabio

On Sep 25, 10:09 am, "Joachim Schmitz" digital.de> wrote:
> "Fabio" schrieb im Newsbeitragnews:1190707457.272413.312880@k79g2000hse.googleg roups.com...> Hi all,
> > I'm looking for a procedure to disable built-in commands in ksh. I
> > would be interested to know how to do it for the kill command, so
> > that
> > users would use the command under /usr/bin and not the built-in
> > commnad.
>
> in /etc/profile, or better in the file mentiond in the variable ENV:
> alias kill=/usr/bin/kill
>
> Bye, Jojo

I appended at the .profile the alias command, but it seems it is not
working...It is like it is overwritten by something else. Which file
are you talking abuot in the ENV variable? I gave a look, but it seems
there is nothing that can help me.

Thanks
Fabio

Re: Disable ksh built-in commands

am 25.09.2007 14:16:41 von Joachim Schmitz

"Fabio" schrieb im Newsbeitrag
news:1190714999.335495.179610@22g2000hsm.googlegroups.com...
> On Sep 25, 10:09 am, "Joachim Schmitz" > digital.de> wrote:
>> "Fabio" schrieb im
>> Newsbeitragnews:1190707457.272413.312880@k79g2000hse.googleg roups.com...>
>> Hi all,
>> > I'm looking for a procedure to disable built-in commands in ksh. I
>> > would be interested to know how to do it for the kill command, so
>> > that
>> > users would use the command under /usr/bin and not the built-in
>> > commnad.
>>
>> in /etc/profile, or better in the file mentiond in the variable ENV:
>> alias kill=/usr/bin/kill
>>
>> Bye, Jojo
>
> I appended at the .profile the alias command, but it seems it is not
> working...It is like it is overwritten by something else. Which file
> are you talking abuot in the ENV variable? I gave a look, but it seems
> there is nothing that can help me.
in /etc/profile or ~/.profile:
ENV=~/.kshrc
export ENV
in ~/.kshrc
alias kill=/usr/bin/kill

for /etc/profile or ~/.profile to take effect you need to log of and on
again or read them in your current shell
.. /etc/profile
resp.
.. ~/.profile

Bye, Jojo

Re: Disable ksh built-in commands

am 26.09.2007 01:36:46 von brian_hiles

Fabio wrote:
> I'm looking for a procedure to disable built-in commands in ksh

command -p /usr/bin kill

Try this to see if you have a sufficient ksh(1) version.

=Brian

Re: Disable ksh built-in commands

am 26.09.2007 03:10:38 von Roland Mainz

Fabio wrote:
> I'm looking for a procedure to disable built-in commands in ksh. I
> would be interested to know how to do it for the kill command, so
> that
> users would use the command under /usr/bin and not the built-in
> commnad.

For the ksh88-based Solaris /usr/bin/ksh this isn't possible except if
you specify a full path (per POSIX standard shell builtin commands are
only used if you specify the command name and _not_ a full path, e.g. $
kill ... # will execute the shell builtin called "kill" (unless the
builtin is bound to a specific path (but that's another (complex) story
which AFAIK doesn't apply in this case)) while $ /usr/bin/kill ... #
will execute the external command "/usr/bin/kill" (note that both are
technicially identical since /usr/bin/kill in Solaris is a ksh shell
script which executes the "kill" builtin)).
There may be some hacks using "alias" but AFAIK this can be bypassed
with some tricks.

For ksh93 (see http://bugs.opensolaris.org/view_bug.do?bug_id=6437624)
there is the command "builtin" which can load, enable and disable
builtin commands (except "special builtins" which are part of the shell
language itself), including the "kill" builtin command.

----

Bye,
Roland

--
__ . . __
(o.\ \/ /.o) roland.mainz@nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 7950090
(;O/ \/ \O;)