Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jul 2003 22:15:21 -0400
From:      Chuck Swiger <cswiger@mac.com>
To:        Rob Lahaye <lahaye@users.sourceforge.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: tcsh script: quote and spaces problems
Message-ID:  <3F29CD39.9080505@mac.com>
In-Reply-To: <3F29C589.4030009@users.sourceforge.net>
References:  <3F29C589.4030009@users.sourceforge.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F29CD39.9080505>