You should not use commands in a test [ ]
unless you simulate a variable with $( )
arround the commands. Still not sure SSH
will return something to the test. SSH
needs the TTY
you like connect to, and not the TTY
you in at. This will causes problems!
An example without SSH ...
suleiman@antec:~$ if [ "$(cat ~/test.txt)" ]; then echo "Hello World"; else echo "failed"; fi
Hello World
suleiman@antec:~$ if [ "$(cat /this/file/dont/exsist 2>/dev/null)" ]; then echo "Hello World"; else echo "failed"; fi
failed
Addition:
-bash: sc: command not found
This means you have NOT installed the spreadsheet
on the host.
This function only making to login in to jump host but not to
secureconsole in to another host from there.
What you trying to do ?
Do you know what SSH
does ?
It opens remote TTYs
, or with other words: it opens a remote secure console.
You cant run a script and put somewhere a ssh login in it, and then think all code after that will be in the new console, neither will that happen.
You can run ssh
on a console, so you get your own TTY and put some commands in it. Or you use ssh
in combination with some commands in a script, like
ssh user@host echo "Hello World!"
You can also pass some variables or text though ssh
via
echo "Hello World!" | ssh user@host cat
There isnt much more you can do with it and you shouldn't!