On Thu, Feb 10, 2005 at 12:14:48PM +1100, Jobst Schmalenbach wrote:
> I dont quite understand why (maybe I am to much thinking of perls
> and phps eval stuff) .... especially if I read bash's man page which
> does not mention anything about what you suggested.

True, it is pretty obscure.  Bash thinks of everything in tokens, and
only evaluates things once.  Usually a token is separated by a space,
but putting quotes (") around the string changes that rule.  So take
the example below

AVARIABLE="this is"
VAR="$AVARIABLE \"a string\""

bash goes through and evaluates VAR *once* according to it's rules
which, in this case leaves VAR looking like (tokens separated by a |)

|this|is|"a|string"|

you need to "re-evaluate" this to convert it to

|this|is|a string|

> Further if I consider
> 
>   --exclude \"\"Temporary Internet Files\"\"
> 
> which after the shell got it should(?) be
> 
>   --exclude \"Temporary Internet Files\"

No, bash will convert that to ""Temporary Internet Files"" which is
also wrong.

> and further if I pass a construct to other
> util they are still "kept together", eg:
> 
>   $MKDIR \"this is a spacy name\"

yes, because \"this is a spacy name\" will be evaulated by bash and
hence form a single token.

-i
[EMAIL PROTECTED]
http://www.gelato.unsw.edu.au

Attachment: signature.asc
Description: Digital signature

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to