eolas/neuron/ac28ab9c-a447-4a90-96b7-2f2694d2a9e4/Quote_marks_in_Bash.md
2025-02-22 14:50:49 +00: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.