Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

1 total

Handling single quotes in Bash

man 2>/dev/null bash | less -p 'Quoting'
man 2>/dev/null bash | less -p "Words of the form \\$'string'"
man 2>/dev/null bash | less -p 'single quote'


echo '\''

echo $'\''
echo $'\x27'
echo $'\047'
echo "'"

echo 'str1'"'"'str2'  # 'str1' + "'" + 'str2'

echo $'single quote \' & double quote "' | sed $'s/& /\\\n/'

str="str's"
echo "${str//\'/''}"
1 total