Ghost files and Bug/misfeature in 4bsd /bin/sh (mid-pipe exit code)
Paul Fox
pgfdp at nzapmb.co.nz
Fri Dec 2 13:56:42 AEST 1988
In article <795 at levels.sait.edu.au>, (DAVID NEWALL) writes:
> But it turned out to be easy, to write a C program to delete the file. It
Several people have talked about writing programs to do this...
the trick is to get "rm" to name the file itself, and not rely on the
shell, which, as has been pointed out, historically uses bit 7 for quoting
purposes. rm itself is perfectly happy with 8-bit characters in filenames.
Use "rm -ri .", and answer rm's questions very carefully.
This certainly isn't "wizard" material anymore...
more like comp.unix.quicktricks
On another topic (just trying to save bandwidth, folks), in a pinch
you can get the exit code for something in the middle of a pipe with:
trap 'rm -f /tmp/ecode$$' 0 1 2 15
a | b | ( c ; echo $? >/tmp/ecode$$ ) | d | e
if [ `cat /tmp/ecode$$` != 0 ]
#etc...
On yet another topic (talk about message overload! (please change the
Subject: if you reply)):
Does anyone have any tricks up their sleeve for using SysV shell
functions for structured (gasp!) shell programming? The argument list
(meaning $* and $#) get clobbered on every function call, which is a
bit of a pain...
----------
paul fox, formerly from nj, currently reachable as pgfdp at apmpyr.nzapmb.co.nz
More information about the Comp.unix.wizards
mailing list