我有这个命令做我想要的但我无法在我的.bashrc中对其进行别名(注意它使用单引号和双引号):
svn status | awk '$1 =="M"{print $2;}'
Run Code Online (Sandbox Code Playgroud)
我试过了:
alias xx="svn status | awk '$1 ==\"M\"{print $2;}'"
Run Code Online (Sandbox Code Playgroud)
还有其他一些没有运气的常识组合..我知道bash非常挑剔引号..所以什么是别名的正确方法,为什么?谢谢
这是别名:
# make a tmux session in working dir with the name of the dir
alias th='tmux new -s $(pwd | tr '\/' '\n' | tail -n 1)'
Run Code Online (Sandbox Code Playgroud)
由于转义字符或'别名内的单引号,它不起作用.打印出来
$ type --all th
th is aliased to `tmux new -s $(pwd | tr / n | tail -n 1)'
Run Code Online (Sandbox Code Playgroud)
看起来它只是剥离了'和\.
我最终通过将单引号更改为双引号来修复它.
# make a tmux session in working dir with the name of the dir
alias th='tmux new -s $(pwd | tr "\/" "\n" …Run Code Online (Sandbox Code Playgroud)