[OpenIndiana-discuss] PATH=/usr/xpg4/bin /bin/ksh -c "rm -f"

James list at xdrv.co.uk
Mon Jun 17 14:45:01 UTC 2019


On 17/06/2019 13:22, Peter Tribble wrote:

>> $ PATH=/usr/xpg4/bin /bin/ksh -c "rm -f"
>> Usage: rm [-cFdfirRuv] file ...
>> ...
>> $ PATH=/usr/xpg4/bin /bin/truss -f /bin/ksh -c "rm -f" |& grep rm
>> 4436:   lstat("/usr/xpg4/bin/rm", 0xFFFFFC7FFFDFDCE0)   = 0
>> Usage: rm [-cFdfirRuv] file ...
>> ...
>>
> I can't see a built-in rm or alias in ksh and if it were I would expect
>> -f to have the same effect.  The path must be making ksh act
>> differently.  What am I not understanding here?
>>
> In ksh, /usr/xpg4/bin/rm is a builtin.
> 
> % ksh builtin | grep /rm
> /bin/rmdir
> /usr/ast/bin/rm
> /usr/ast/bin/rmdir
> /usr/xpg4/bin/rm

I see, thank you for guiding me. I was checking with which and whence

$ zsh
$ which rm
/usr/xpg4/bin/rm
$ which [
[: shell built-in command
$ which which
which: shell built-in command

$ ksh
$ which rm
/usr/xpg4/bin/rm      <- no mention of builtin
$ which which
/bin/which            <- could be because which is not builtin
$ builtin | grep wh
whence
$ whence rm           <- try the builtin whence 

/usr/xpg4/bin/rm      <- no mention of builtin

ksh does not report like zsh.

The man page does not document it and I expect the built in rm to follow 
what it is substituting, (possibly we discover /usr/xpg4/bin/rm has been 
in error for 25 years).

This causes autoconf/configure to fail when it checks rm (checking punch 
tape reader LUN, checking for UNIVAC 18 bit words)

I've had xpg4 in my path for so long I've forgotten if it's still needed.












More information about the openindiana-discuss mailing list