tcsh script: quote and spaces problems

Chuck Swiger cswiger at mac.com
Thu Jul 31 19:15:31 PDT 2003


Rob Lahaye wrote:
[ ... ]
> Any solutions for this problem with quotes and spaces in tcsh script?
> Or is tcsh not suitable for this kind of things?

Ugh, the latter.  :-)  /bin/sh handles nested quoting right, but crunches the 
space together:

% foo="-f \"t  \""
% echo $foo
-f "t "

% foo='-f "t  "'
% echo $foo
-f "t "

...however, you might be able to muck with $IFS and get better results. Also, 
ZSH seems to do exactly what you expected:

64-sec% foo="-f \"t  \""
65-sec% echo $foo
-f "t  "

67-sec% foo='-f "t  "'
68-sec% echo $foo
-f "t  "


-- 
-Chuck




More information about the freebsd-questions mailing list