* csh bug w/ "$*"
@ 1994-10-25 16:24 Brian R. Hunt
0 siblings, 0 replies; only message in thread
From: Brian R. Hunt @ 1994-10-25 16:24 UTC (permalink / raw)
We're running DEC OSF/1 V1.3 (Rev. 111) on a DEC 3000/600, and find in
a csh script, referring to the argument list as "$*" pollutes the
arguments in a way I don't understand--the pollution has to do with
whether or not backslashes and quotes are expanded in varius
contexts. The pollution does not occur when the supposedly equivalent
"$argv[*]" is used. Consider the following shell script "zzz":
#!/bin/csh -f
set var1="$1"
set var2="$argv[*]"
set var3="$1"
set var4="$*"
set var5="$1"
set
echo $var1 $var2 $var3 $var4 $var5
eval "$var1"
eval "$var2"
eval "$var3"
eval "$var4"
eval "$var5"
With the command line
zzz "a'b'\c"
the output (minus the irrelevant part of the output from the "set"
command) is:
var1 a'b'\c
var2 a'b'\c
var3 a'b'\c
var4 a'b'\c
var5 a'b'\c
a'b'\c a'b'\c a'b'\c abc abc
abc: Command not found.
abc: Command not found.
abc: Command not found.
a'b'\c: Command not found.
a'b'\c: Command not found.
Whatever the difference between variables 1-3 (defined before "$*" is
used) and variables 4-5 (defined in terms of or after "$*"), it
doesn't show up in the output of "set", but when the variables are
used by echo or eval it becomes clear there is some difference. I
don't have this problem with tcsh or with any other brand of csh I've
tried.
Obviously I can work around this using "$argv[*]", just thought
someone out there should know...
--
Brian R. Hunt
bhunt@glue.umd.edu
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1994-10-25 16:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-10-25 16:24 csh bug w/ "$*" Brian R. Hunt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox