用单引号和双引号的bash alias命令 [英] bash alias command with both single and double quotes

查看:1334
本文介绍了用单引号和双引号的bash alias命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的命令,我想要做什么,但我不能去别名它在我的.bashrc(请注意,它使用单引号和双引号):

I have this command that does what I want but I can't get to alias it in my .bashrc (note that it uses both single and double quotes):

svn status | awk '$1 =="M"{print $2;}'

我试过:

alias xx="svn status | awk '$1 ==\"M\"{print $2;}'"

和没有运气其他一些常识的组合。我知道,庆典是非常挑剔的报价..那么什么是它的别名,为什么正确的方法是什么?谢谢

And some other common sense combinations with no luck.. I know that bash is very picky with quotes.. So what's the correct way to alias it and why ? Thanks

推荐答案

您只需要正确地逃脱了。

You just need to escape it correctly.

alias xxx="svn status | awk '\$1 ==\"M\"{print \$2;}'"

这篇关于用单引号和双引号的bash alias命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆