Question : double quotes inside double quotes bash
Answered by : daddy
'"'"'something'"'"' is equivalent to 'something'
"'"'"something"'"'" is equivalent to "something"
#Example usage
echo "hey "Dora""
>>hey Dora
echo "hey "'"'"Dora"'"'""
>>hey "Dora"
Source : https://stackoverflow.com/a/1250279/17192981 | Last Update : Wed, 16 Mar 22
Question : bash single vs double quotes
Answered by : charlesalexandre-roy
# Short answer:
# Single quotes don't allow interpolation, but double quotes do
# Long answer:
# From Wikipedia:
# In computer programming, string interpolation (or variable interpolation,
# variable substitution, or variable expansion) is the process of evaluating
# a string literal containing one or more placeholders, yielding a result in
# which the placeholders are replaced with their corresponding values.
# Concrete example:
echo "$(echo 'word')" # here, "$(echo 'word')" gets interpolated (interpreted)
--> word
echo '$(echo "word")' # here, '$(echo "word")' is echoed literally (no interpolation)
--> $(echo "word")
# Note, this link also has some good info:
https://stackoverflow.com/questions/10067266/when-should-i-wrap-quotes-around-a-shell-variable/42104627#42104627
Source : https://stackoverflow.com/questions/6697753/difference-between-single-and-double-quotes-in-bash | Last Update : Thu, 03 Mar 22