Created
July 15, 2019 05:59
-
-
Save kujyp/ba3d7be1bb5e7e44e03c5b350fb10bcf to your computer and use it in GitHub Desktop.
subshell ``, $() check differences
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
a=abc!! | |
echo a=[$a] | |
echo "" | |
result=`echo $a | sed -e 's/!/\\\\!/g'` | |
echo \`~\`=[$result] | |
echo "" | |
result=$(echo $a | sed -e 's/!/\\\\!/g') | |
echo \$\(~\)=[$result] | |
echo "" | |
# > a=[abc!!] | |
# > | |
# > `~`=[abc\!\!] | |
# > | |
# > $(~)=[abc\\!\\!] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment