lhunath 1401805644 learn You should almost always "double quote your $expansions". There are a few cases where quotes are optional, though: in assignments that contain no literal spaces (eg. foo=$bar), inside [[ except for the RHS (eg. [[ -e $file ]]) and inside complex PEs that are already quoted (eg. echo "${file//$USER/bob}"). greycat 1537284999 forget greycat 1537285001 learn "Double quotes" are optional for the word following 'case', the RHS of simple assignments (e.g. foo=$bar), inside [[ except for the RHS of =~ or = (e.g. [[ -f $file ]]), or inside complex PEs that are already quoted (e.g. "${file//$USER/bob}"). greycat 1565196449 forget greycat 1565196475 learn "Double quotes" are optional for the word following 'case', the RHS of simple assignments (e.g. foo=$bar), or inside [[ except for the RHS of =~ or = (e.g. [[ -f $file ]]) emanuele6 1645403200 forget emanuele6 1645403667 learn "Double quotes" are optional for the word following 'case', the RHS of simple assignments (e.g. foo=$bar), or inside [[ except for the RHS of =~ or = (e.g. [[ -f $file ]]); "Double quotes" are also optional for substitution in associative (not indexed) array subscripts ( e.g. declare -A foo; ...; foo[$k]=abc ) emanuele6 1645403694 forget emanuele6 1645403731 learn "Double quotes" are optional for the word following 'case', the RHS of simple assignments (e.g. foo=$bar), or inside [[ except for the RHS of =~ or = (e.g. [[ -f $file ]]); "Double quotes" are also optional for substitutions in associative array subscripts ( e.g. declare -A foo; ...; foo[$k]=abc ) emanuele6 1645403861 forget emanuele6 1645403873 learn "Double quotes" are optional for the word following 'case', the RHS of simple assignments (e.g. foo=$bar), or inside [[ except for the RHS of =~, =, == or != (e.g. [[ -f $file ]]); "Double quotes" are also optional for substitutions in associative array subscripts ( e.g. declare -A foo; ...; foo[$k]=abc )