Hi everybody,
Currently, I have a script which access a remote computer via SSH, go to a folder already defined in the code and then executes a program in it, just like that:
ssh user@host << EOI
cd path
./file
EOI
It executes fine, but now I want to pass an argument in the command line call. which is the name of the folder to "cd" to and the name of the file to run. So I tried the following:
dir= $1
ssh user@host << EOI
cd $dir
pwd
./$1
EOI
, which doesn't work. It's as if after the "ssh user@host << EOI" line the script lost knowledge of the variable $dir as well as $1.
I'm pretty noob in shell scripting, so would you know any way to solve this?
Thanks in advance,
Luiz.