A simple demonstration how quoting a variable prevents the shell from breaking up a variable value containing whitespaces
Code:
$ FILE="name with spaces"
$ cat $FILE
cat: name: No such file or directory
cat: with: No such file or directory
cat: spaces: No such file or directory
Here the shell breaks up the value of the FILE variable into 3, and passes them to the
cat utility. Because
cat accepts multiple files, it first tries to display file "name", then file "with" and file "spaces". Because these files don't exist, we see
cat issueing three error messages.
The same command but now using a quoted FILE variable
Code:
$ cat "$FILE"
cat: name with spaces: No such file or directory
Now
cat only gives one single message: there is no file "name with spaces".