Question

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:

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:

tunnels.sh 1: tunnels.sh: Syntax error: "(" unexpected

I am a extreme newbie to shell scripts in linux so please be kind.

Was it helpful?

Solution

There is a syntax error with this:

a=(`ps -ef | grep 19999 | grep -v grep`)

It should simply be:

a=`ps -ef | grep 19999 | grep -v grep`

There's no need for parentheses there, although there is an alternate syntax to accomplish the same thing:

a=$(ps -ef | grep 19999 | grep -v grep)

Note the addition of the $ and that the backticks are no longer necessary.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top