If you have multilined data that you're going to echo, the quotes will preserve the newlines.
$ DATA="foo bar"; $ echo $DATA foo bar $ echo "$DATA" foo bar $The first reason I tend to think of is so spaces in file names aren't mistranslated as separators between arguments.
$ FILENAME="foo bar.txt" $ ls -l $FILENAME ls: cannot access foo: No such file or directory ls: cannot access bar.txt: No such file or directory $ ls -l "$FILENAME" -rw-rw-r--. 1 user group 0 27. Jul 18:03 foo bar.txt $
No comments:
Post a Comment