I've written a bash script that should take in inputs, connect to a remote server, and run a series of commands using the given inputs. It will end up being much more complicated than this but here is a very simple example:
#!/bin/bash
NAME=$1
echo $NAME
ssh user@server "ls $NAME"
If I hard code the file name into the bash script's ssh command, I get a response and if I type these exact lines, setting $NAME to my file name, into the command line, I get the correct response but the combination of passing in the file name to the script and attempting to return the "ls" returns an error stating that there is "no such file or directory". It does echo the file name I give it so it's being stored correctly in $NAME. What am I doing wrong?
ls
w/o the name and/or apwd
to make sure the other end what you expect.echo "$NAME"