alias in cshell with grave accents, apostrophes and more

独自空忆成欢 提交于 2019-12-04 15:55:42

Welcome to the hell that is csh. I'm not sure this answer will prevent you from killing yourself, but...

% alias doit 'ls -l | grep $USER | somescript `awk -F'"'"' '"'"' '"'"'{print $1}'"'"'`'

Result:

% alias | grep doit
doit    ls -l | grep $USER | somescript `awk -F' ' '{print $1}'`

It's basically a concatenation of strings, each in alternating quotes:

'ls -l | grep $USER | somescript `awk -F'
"'"
' '
"'"
' '
"'"
'{print $1}'
"'"
'`'

(Yes, this could be simplified, but I wanted to show a consistent, general procedure for aliasing commands containing single-quotes.)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!