[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug in cron postinst

On Wed, Sep 03, 2003 at 11:12:36AM +0200, Goswin von Brederlow wrote:
> Andreas Metzler <ametzler@downhill.at.eu.org> writes:
> > Goswin von Brederlow <brederlo@informatik.uni-tuebingen.de> 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).

> > ametzler@downhill:/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)
> mrvn@dual:/tmp/bar% touch "a b"
> mrvn@dual:/tmp/bar% L=`find`                     
> mrvn@dual:/tmp/bar% for i in $L; do echo $i; done
> .
> ./a b
> mrvn@dual:/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                                  [cjwatson@flatline.org.uk]

Reply to: