我正在学习如何运行在http://wiki.fabelier.org/index.php?title=Permanent_Reverse_SSH_Tunneling处找到的反向ssh隧道的教程我遇到的问题是当我运行tunneling.sh脚本时:
#!/bin/sh
a=`ps -ef | grep 19999 | grep -v grep`
if [ ! "$a" ]; then
ssh -fN -R 19999:localhost:22 <middle-usename>@<middle-hostname>
fi
我收到此错误:
tunnel2.sh: 2: tunnel2.sh: a: not found
编辑:
我将shebang改为#!/ bin / bash
现在我收到了这个错误:
tunnel2.sh: 2: tunnel2.sh: pi: not found
答案 0 :(得分:6)
如果您要使用bash功能,请不要在“shebang”行中指定#!/bin/sh
。如果你想要bash,请求bash。
答案 1 :(得分:0)
如果您需要sh
,请将!
移出test [
if ! [ "$a" ]; then