lhunath 1224576778 learn When to quote: Use "double quotes" around every string that contains a "$parameter" expansion, white space, or characters like *, ?, ... Use 'single quotes' to disable parameter expansion, too. Don't quote PEs in assignments (foo=$bar), inside (( .. )) or inside [[ .. ]] (you DO need quotes in [ .. ]!) lhunath 1251899230 forget lhunath 1251899459 learn Double quote *EVERY* argument that contains whitespace, expansions: $foo, $(foo), `foo` (and * or ? if you don't want *bash* to expand them). Single quote them to also disable expansions. lhunath 1252012653 forget lhunath 1252012757 learn "Double quote" *EVERY* argument that contains whitespace or expansions ("$foo", "$(foo)", "`foo`" and * or ? if you don't want them to expand). Use 'Single quotes' to also disable those expansions. lhunath 1253702256 forget lhunath 1253702422 learn "Double quote" *EVERY* argument that contains whitespace or expansions ("$foo", "$(foo)", "`foo`"). 'Single Quotes' prevent expansions from happening at all. Also quote *, [, ], ? etc. if you don't want bash to expand them into filenames. ferret 1297952449 forget ferret 1297952712 learn "Double quote" *EVERY* argument that contains spaces or expansions ("foo bar", "$foo", "$(foo)", "`foo`"). 'Single Quotes' prevents all expansions and other special characters, notably * ? [ ] greycat 1299794311 forget greycat 1299794317 learn #redirect quotes greycat 1299794368 forget greycat 1299794405 learn "Double quote" everything that has a $ in it, if you want the $ to be expanded. 'Single quote' everything that you DON'T want expanded. e36freak 1302843322 forget e36freak 1302843410 learn "Double quote" _every_ parameter expansion, and anything that could possibly have a space in it. Bash treats everything within 'single quotes' as literal. See http://mywiki.wooledge.org/Arguments e36freak 1302843568 forget e36freak 1302843614 learn "Double quote" _every_ parameter expansion, and anything that could possibly have a space in it ("$foo", "$@", "${array[@]}"). Bash treats everything within 'single quotes' as literal. See http://mywiki.wooledge.org/Arguments e36freak 1302843679 forget e36freak 1302843681 learn "Double quote" _every_ parameter expansion, and anything that could possibly have a space in it ("$foo", "$@", "${array[@]}"). Bash treats everything within 'single quotes' as literal. See http://mywiki.wooledge.org/Arguments and http://mywiki.wooledge.org/BashPitfalls e36freak 1302843850 forget e36freak 1302843877 learn "Double quote" _every_ parameter expansion, and anything that could possibly have a space in it, i.e. "$foo", "$@", "${array[@]}", "$(command)". Bash treats everything within 'single quotes' as literal. See http://mywiki.wooledge.org/Arguments and http://mywiki.wooledge.org/BashPitfalls e36freak 1302916227 forget e36freak 1302916233 learn "Double quote" _every_ parameter expansion, and anything that could possibly have a space in it, i.e. "$foo", "$@", "${array[@]}", "$(command)". Bash treats everything within 'single quotes' as literal. See , and lhunath 1304934359 forget lhunath 1304934388 learn "Double quote" _every_ parameter expansion, and anything that could possibly have a space in it or be empty, i.e. "$foo", "$@", "${array[@]}", "$(command)". Bash treats everything within 'single quotes' as literal. See , and e36freak 1305173661 forget e36freak 1305173669 learn "Double quote" _every_ parameter expansion, and anything that could possibly contain a special character, e.g. "$var", "$@", "${array[@]}", "$(command)". Bash treats everything within 'single quotes' as literal. See , and e36freak 1306972303 forget e36freak 1306972348 learn "Double quote" _every_ expansion, and anything that could possibly contain a special character, e.g. "$var", "$@", "${array[@]}", "$(command)". Bash treats everything within 'single quotes' as literal. See , and e36freak 1306972502 forget e36freak 1306972511 learn "Double quote" _every_ parameter expansion, and anything that could possibly contain a special character, e.g. "$var", "$@", "${array[@]}", "$(command)". Bash treats everything within 'single quotes' as literal. See , and lhunath 1313794041 forget lhunath 1313794088 learn "Double quote" _every_ expansion, and anything that could possibly contain a special character, e.g. "$var", "$@", "${array[@]}", "$(command)". Bash treats everything within 'single quotes' as literal. See , and yitz_ 1365441194 forget yitz_ 1365441212 learn "USE MORE QUOTES!" and "Double quote" _every_ expansion, as well as anything that could possibly contain a special character, e.g. "$var", "$@", "${array[@]}", "$(command)". Bash treats everything within 'single quotes' as literal. Learn the difference between ' and " and `. See , , and , and . lhunath 1367418733 forget lhunath 1367418966 learn "Double quote" _every_ expansion, and anything that could contain a special character, eg. "$var", "$@", "${array[@]}", "$(command)". Use 'single quotes' to make something literal, eg. 'Costs $5 USD'. See , and . lhunath 1403405122 forget lhunath 1403405342 learn "Double quote" _every_ expansion: "$var", "$@", "${array[@]}", "$(command)". Use 'single quotes' to make something literal: 'Costs $5 US'. Always single-quote literal code: ssh "$host" 'echo $HOME'. See , and . lhunath 1403802343 forget lhunath 1403802553 learn "Double quote" every literal that contains spaces/metacharacters and _every_ expansion: "a & b", "$var", "${array[@]}", "$(command)". Use 'single quotes' for code or to make something literal: 'Costs $5 US', ssh host 'echo "$HOSTNAME"'. See , and . lhunath 1414603970 forget lhunath 1414604094 learn "Double quote" every literal that contains spaces/metacharacters and _every_ expansion: "$var", "$(command "$var")", "${array[@]}", "a & b". Use 'single quotes' for code or literal $'s: 'Costs $5 US', ssh host 'echo "$HOSTNAME"'. See , and . b317 1420885936 forget b317 1420885976 learn "Double quote" every literal that contains spaces/metacharacters and _every_ expansion: "$var", "$(command "$var")", "${array[@]}", "a & b". Use 'single quotes' for code or literal $'s: 'Costs $5 US', ssh host 'echo "$HOSTNAME"'. See http://mywiki.wooledge.org/Quotes , http://mywiki.wooledge.org/Arguments and http://wiki.bash-hackers.org/syntax/words . nai 1548943768 forget nai 1548943772 learn "Double quote" every literal that contains spaces/metacharacters and _every_ expansion: "$var", "$(command "$var")", "${array[@]}", "a & b". Use 'single quotes' for code or literal dollar signs: 'Costs $5 US', ssh host 'echo "$HOSTNAME"'. See http://mywiki.wooledge.org/Quotes , http://mywiki.wooledge.org/Arguments and http://wiki.bash-hackers.org/syntax/words .