Repeat of a question posted to net.unix (resp: shell processing)

mouse at mcgill-vision.UUCP mouse at mcgill-vision.UUCP
Mon Sep 29 12:03:54 AEST 1986


In article <5867 at topaz.RUTGERS.EDU>, dpz at topaz.RUTGERS.EDU (David P. Zimmerman) writes:
>> Assume that file "nxf" does not exist.
>> Assume that the following lines are in shell script 'cmd':
>>
>>   #!/bin/csh
>>   rm nxf         >& cmd_out
>>   echo $status   >  cmd_stat
>
> Same problem here on a 4.2 system.  But replace "rm nxf" with "ping
> foo" or "test" and everything works OK.  Bug in rm?

No, a feature in rm.  If rm's standard input is not a terminal, the -f
flag is turned on, which makes rm ignore all error conditions
(including "file does not exist").  I just now checked this in the 4.3
source code; presumably other systems which exhibit this behavior have
similar tests.

This is only sort of documented in the man page for rm; perhaps the
documentation should be cleaned up?

					der Mouse

USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!mcgill-vision!mouse
     think!mosart!mcgill-vision!mouse
Europe: mcvax!decvax!utcsri!mcgill-vision!mouse
ARPAnet: think!mosart!mcgill-vision!mouse at harvard.harvard.edu

	Aren't you glad you don't shave with Occam's Razor?



More information about the Comp.unix.wizards mailing list