Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!uwvax!oddjob!gargoyle!ihnp4!homxb!houxm!hou2d!avr From: avr@hou2d.UUCP (Adam V. Reed) Newsgroups: comp.unix.questions Subject: Re: Recovery scripts: use $@ Message-ID: <1456@hou2d.UUCP> Date: Sun, 5-Jul-87 08:35:05 EDT Article-I.D.: hou2d.1456 Posted: Sun Jul 5 08:35:05 1987 Date-Received: Mon, 6-Jul-87 06:42:45 EDT References: <913@rtech.UUCP> <7062@mimsy.UUCP> <767@bsu-cs.UUCP> <506@its63b.ed.ac.uk> Organization: AT&T Bell Laboratories, Holmdel Lines: 24 Keywords: #!, csh, ksh Summary: Use ksh `ksh -c "whence $0"` $@ In article <506@its63b.ed.ac.uk>, simon@its63b.ed.ac.uk (Simon Brown) writes: > In article <1444@hou2d.UUCP> avr@hou2d.UUCP (Adam V. Reed) writes: > >In article <1500@ho95e.ATT.COM>, wcs@ho95e.ATT.COM (Bill.Stewart) writes: > >> I generally write all my scripts in Bourne Shell, because I know they'll work > >> (relatively) portably. When it's important to use ksh, I use the following: > >> if [ "$RANDOM" = "$RANDOM" ] > >> ksh -c "$0 $*" > >> exit "$?" > >> fi > >> Writing a good recovery script is hard; if the arguments to the program > >> contain white space or metacharacters, the $* will trash them. > >Use $@ instead of $*. > This will not work for a "sh -c command" type thing - the ``command'' must > be a single word, and "$@" splits up into lots of separate words - so, better > would be to use > ksh "$0" "$@" If $0 is not in the current directory, you will get "file not found". The correct command to put in recovery scripts using $@ is ksh `ksh -c "whence $0"` $@ This might not work for you, because in some early versions of ksh "whence" and/or $@ did not always work correctly. I understand that Dave Korn has already fixed this. Adam Reed (hou2d!avr)