On Wed, Sep 03, 2003 at 11:12:36AM +0200, Goswin von Brederlow wrote:
> Andreas Metzler <[EMAIL PROTECTED]> writes:
> > Goswin von Brederlow <[EMAIL PROTECTED]> wrote:
> > > And lets add a user with homedir "`rm -rf ..`" just for fun.

Variable expansion happens at the same time as command substitution, not
before it. See EXPANSION in bash(1).

> > [EMAIL PROTECTED]:/tmp/big> bar="\`yes\`"
> > echo $bar
> > `yes`
> 
> I'm allways a bit overcarefull with for loops, globing and splitting.
> Depending on the shell you get different behaviours. In this simple
> case it seems to work out right but take the following as an example:
> 
> (my normal shell is zsh)
> [EMAIL PROTECTED]:/tmp/bar% touch "a b"
> [EMAIL PROTECTED]:/tmp/bar% L=`find`                     
> [EMAIL PROTECTED]:/tmp/bar% for i in $L; do echo $i; done
> .
> ./a b
> [EMAIL PROTECTED]:/tmp/bar% bash
> bash-2.05b$ L=`find`              
> bash-2.05b$ for i in $L; do echo $i; done
> .
> ./a
> b

No wonder. You aren't quoting correctly! Use 'echo "$i"'.

-- 
Colin Watson                                  [EMAIL PROTECTED]


Reply via email to