- if you have spaces in $HOME variable, use more quotes
Actually not entirely true. Setting the variable "manually" like this will require quoting:
# Does not work
var=this is a spaced string
var="this is a spaced string"
Using read this is not an issue, the input to read is directly put into the variable.
:~> cat a.sh
# -p "Input: " will only print "Input: "
read -p "Input: " var
echo "Output: $var"[email protected]
:~> bash a.sh
Input: Testing with spaces alot of them ;)
Output: Testing with spaces alot of them ;)