eolas/neuron/3962ef80-32e3-49b8-8e16-d14a26e9787a/Quote_marks_in_Bash.md
2024-10-22 16:47:58 +01:00

542 B

tags
shell

Quote marks in Bash

Single-quotes (aka strong quotes)

Bash will interpret everything in the string as a literal:

echo 'The directory is $(pwd)'
# The directory is $(pwd)

Double-quotes

Bash will interpret strings as strings but will interpret expansions and substitutions as executable processes:

$pointlessVar='directory'

echo "The ${pointlessVar}"

# The directory is /home/thomas

It is therefore generally best to use double quotes whenever we wish to return mixed values.