Path: utzoo!attcan!uunet!munnari!bruce!goanna!yabbie!rcodi From: rcodi@yabbie.rmit.oz (Ian Donaldson) Newsgroups: comp.bugs.sys5 Subject: Quoted space (was: Re: compressdir bug?) Message-ID: <864@yabbie.rmit.oz> Date: 17 Sep 88 07:11:22 GMT References: <450@gt-ford.gtisqr.UUCP> Organization: RMIT Comm & Elec Eng, Melbourne, Australia. Lines: 44 From article <450@gt-ford.gtisqr.UUCP>, by stu@gtisqr.UUCP (Stu Donaldson): > As I said, my solution was to create /bin/test. Here is a copy, > it is incredibly simple. > > : > # /bin/test > if [ $* ] > then > exit 0 > else > exit 1 > fi > > As you can see, it relies on the test command implimented within > the shell. Whilst it is functionally compatable with a real /bin/test most of the time, it does fall down when quoted strings containing white space are passed as arguments. eg: newtest "hello there" = "hello there" But this is really a problem with $* breaking the arguments up. From sh(1) man page, under the section on Quoting, "$*" is equivalent to "$1 $2 ..." and "$@" is equivalent to "$1" "$2" ... So the script should really be: : # /bin/test if [ "$@" ] then exit 0 else exit 1 fi This version works much better. Ian D