Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!hp4nl!botter!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.questions Subject: Re: use of set in a shell script Message-ID: <5060@solo9.cs.vu.nl> Date: 8 Jan 90 21:58:43 GMT References: <472@cpsolv.UUCP> Reply-To: maart@cs.vu.nl (Maarten Litmaath) Organization: VU Informatika, Amsterdam, the Netherlands Lines: 41 In article <472@cpsolv.UUCP> rhg@cpsolv.UUCP (Richard H. Gumpertz) writes: \... set $DIRS \ find $@ -type f -exec ... \ \... Isn't the above \roughly equivalent to (but slower than) \ find $DIRS -type f -exec ... \where the set command has been deleted? The only difference I can see is that \the version with the set command will make one more passing unquoting things, \which could have been avoided using \ set $DIRS \ find "$@" -type f -exec ... What will happen to an unquoted variable? 1) It is broken up into words at sequences of IFS. 2) It is globbed. No unquoting. \Are there any other subtle differences that I missed? Is there any way to \avoid the one pass of unquoting things that seems to remain in either case? optc=0 optv= for i do case $i in -*) optc=`expr $optc + 1` eval optv$optc='"$i"' optv="$optv \"\$optv$optc\"" ;; *) # you get the idea esac done eval set $optv # restore the options EXACTLY -- 1755 EST, Dec 14, 1992: Henry Spencer is put on a one-way mission to the moon.| Maarten Litmaath @ VU Amsterdam: maart@cs.vu.nl, uunet!mcsun!botter!maart