I have different servers with different IPs with I can ssh in any servers and get my database intact (I don't know how, I am just an user). I have written one script to move from one server to other server using ssh in the same directory where I was in first server.
Here you can see final command that if I type will work:
ssh -X [email protected] -t 'cd /home/usr/regression && exec /bin/csh'
Now here a part of small script:
set path = $PWD
set user = $1
set cmd = "ssh -X [email protected].$ip3.$ip4 -t 'cd $path && exec $SHELL'"
echo $cmd;
$cmd;
Since It is csh/tcsh script I just want to run
$cmd
command but it give this message:
ssh: Command not found.
While If I copy,paste and run the final command that I am getting with:
echo "$cmd"
Like :
ssh -X [email protected] -t 'cd /home/usr/regression && exec /bin/csh'
Then It works fine.
The path
variable in csh is a magic array tied to the PATH
environment variable. When you changed it, you lost your original PATH
. Not just ssh, but all external commands will fail after that because none of them can be found, unless they are in $PWD
which is your new PATH
.
Call your path
variable something else.