Liste des Groupes | Revenir à cu programmer |
Ralf Fassel <ralfixx@gmx.de> writes:* Richard Kettlewell <invalid@invalid.invalid>>
| Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
| > [...] For example, I might type something like:
| >
| > for file in * ; do cp -p $file $file.bak ; done
|
| That’s the heart of the matter. Field splitting happens after
| parameter expansion.
>
Only sometimes it doesn't :-)
>
$ foo="foo bar"
$ bar=$foo
>
No problem with the space in the expanded value here!
>
$ echo $bar
foo bar
>
but of course:
ls $bar
ls: cannot access 'foo': No such file or directory
ls: cannot access 'bar': No such file or directory
Fair point. “Field splitting happens after parameter expansion, except
when it doesn’t”.
Les messages affichés proviennent d'usenet.