[英]convert alias command from tcsh to bash
I'm new to bash. 我是bash的新手。 I want to convert below alias command form tcsh to bash:
我想将以下别名命令格式tcsh转换为bash:
alias buzz 'echo \!$;if (-e ~/.sshelp.txt) grep -i \!$ ~/.sshelp.txt && echo \!$;if (-e ~/.sshelp_qct.txt) grep -i \!$ ~/.sshelp_qct.txt '
I tried below command but it doesn't work. 我试过下面的命令,但不起作用。 Any suggestions?
有什么建议么?
alias buzz= 'echo \!$;if (-e ~/.sshelp.txt) grep -i \!$ ~/.sshelp.txt && echo \!$;if (-e ~/.sshelp_qct.txt) grep -i \!$ ~/.sshelp_qct.txt '
Define a function in bash
. 在
bash
定义一个函数。 C shells define aliases because they don't support functions. C Shell定义别名是因为它们不支持函数。 I think the following is (roughly) equivalent.
我认为以下内容大致相同。
buzz () {
echo "$1"
if [ -e ~/.sshelp.txt ]; then
grep -i "$1" ~/.sshelp.txt && echo "$1"
fi
echo "$1"
if [ -e ~/.sshelp_qct.txt ]; then
grep -i "$1" ~/.sshelp_qct.txt
fi
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.