Will Sheppard
Posted on November 18, 2024
docker compose exec site bash -c 'PGPASSWORD=***** psql -Ufoo -d bar \
-h example.com -x -c "select qux, date(xyzzy) from tabley \
where field in(1, 2, 3) and that_time > '"'"'2024-11-18'"'"' \
order by that_time;"'
Explanation:
'"'"'
is the Quoteception operator. When used in the middle of a single quoted string, it:
-
'
Ends the single quoted string -
"
Starts a new double quoted string -
'
Containing only one single quote -
"
Ends the double quoted string -
'
Starts the next single quoted string
Or described another way:
echo 'Embedded single quote is here: '"'"' did you see it?'
echo 'Embedded single quote is here: ' \
"'" \
' did you see it?'
Outputs:
Embedded single quote is here: ' did you see it?
💖 💪 🙅 🚩
Will Sheppard
Posted on November 18, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.