send "if [ `ps -ef | grep ttyS1 | sed -n 1p | cut -d ' ' -f 2` -eq 'ttyS1' ]; then
not_found='false'
else
not_found='true'
fi\r"
我已经在ttyS1下尝试了很多次使用双引号和单引号,但是显示1)ttyS1:未知操作数2)双引号的错误编号
您使用-eq
哪个用于比较数字。您=
在比较字符串时
send "if [ `ps -ef | grep ttyS1 | sed -n 1p | cut -d ' ' -f 2` = 'ttyS1' ]; then
not_found='false'
else
not_found='true'
fi\r"
您可以使用双引号,因为它们已经被使用了。您也可以不ttyS1
带任何引号的字符串
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句