引用符のエスケープ問題$ perl -e "print 'hello world'" hello world
$ perl -e 'print 'hello world''
解法(1) 'print 'hello world'' (2) 'print '\'hello world'' (3) 'print '\''hello world'' (4) 'print '\''hello world'\'
参考(1) bash -c "echo -n 'hello, ' && sleep 3 && echo -n 'World'" (2) bash -c 'echo -n 'hello, ' && sleep 3 && echo -n 'World'' (3) bash -c 'echo -n '\''hello, '\'' && sleep 3 && echo -n '\''World'\'
$'...'を使った解法perl -e $'print \'hello world\''
参考https://unix.stackexchange.com/questions/30903/how-to-escape-quotes-in-shell |
|