Command fails via 'bash
This question already has an answer here:
You cannot escape single quotes inside single quotes that way. It does not work.
Your command is being seen as
sudo lspci -vvv | awk /System peripheral/ {portn=$1} /Status:/ {split($3,a,"M");printf "%sn",a[1]}
which fails.
To place a single quote inside a single quoted string you need to use '''
.
So your command becomes:
bash -c 'sudo lspci -vvv | awk '''/System peripheral/ {portn=$1} /Status:/ {split($3,a,"M");printf "%sn",a[1]}''
链接地址: http://www.djcxy.com/p/57138.html
下一篇: 命令通过'bash失败