I am following a tutorial on how to run a reverse ssh tunnel which is found at http://wiki.fabelier.org/index.php?title=Permanent_Reverse_SSH_Tunneling Issue I am having is when I run the tunneling.sh script:
#!/bin/sh
a=`ps -ef | grep 19999 | grep -v grep`
if [ ! "$a" ]; then
ssh -fN -R 19999:localhost:22 <middle-usename>@<middle-hostname>
fi
I receive this error:
tunnel2.sh: 2: tunnel2.sh: a: not found
EDIT:
I changed shebang to #!/bin/bash
now I get this error:
tunnel2.sh: 2: tunnel2.sh: pi: not found
Don't specify #!/bin/sh
in your "shebang" line if you're going to use bash features. If you want bash, ask for bash.
Move the !
out of the test [
if you need sh
if ! [ "$a" ]; then
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.