In my Bash environment I use variables containing spaces, and I use these variables within command substitution. Unfortunately I cannot find the answer on SE.
What is the correct way to quote my variables? And how should I do it if these are nested?
DIRNAME=$(dirname "$FILE")
or do I quote outside the substitution?
DIRNAME="$(dirname $FILE)"
or both?
DIRNAME="$(dirname "$FILE")"
or do I use back-ticks?
DIRNAME=`dirname "$FILE"`
What is the right way to do this? And how can I easily check if the quotes are set right?