开发者

ipython shell awk : Escaping "$" sign

开发者 https://www.devze.com 2023-01-14 10:08 出处:网络
I am figuring out the Ipython shell support. Its seems awk doesn\'t worki.e following command !ls -l | awk \'{print $1}\'

I am figuring out the Ipython shell support. Its seems awk doesn't work i.e following command

!ls -l | awk '{print $1}' 
开发者_如何学运维

just prints "1".

How do I pass the "$" sign correctly to shell. I am using zsh.


Two dollar signs give you a literal dollar sign, so try:

!ls -l | awk '{print $$1}'


Try escaping $ as \$

!ls -l | awk '{print \$1}' 
0

精彩评论

暂无评论...
验证码 换一张
取 消