Why Use Double Quotes around Variables in Bash?

Using double quotes never really made much sense until I tried this

First, set $x

x='-e h\ti'

Now look at these results

command result effective command comment
echo $x h i echo -e h\ti A variable can be used to specify options, such a -e in this case.
echo "$x" -e h\ti echo '-e h\ti' Double quotes around the variable prevent it from being used in options.
Your rating: None Average: 5 (1 vote)