I'm trying to run a shell script remotely. I'm having a resource(.txt file) in one machine and a shell script in another machine, but in the same network. The script resides in a particular directory and the script takes some binary files that resides in some other directory everything in the target machine. Now, I'm not able to run the script remotely. But I can run a simple shell program which does not have any local dependencies. Can you please suggest a solution to resolve this problem?
Here is the command that I used for running a shell-script-without-any-dependencies.
cat input.txt | ssh clrg@192.168.2.22 "sh path/to/shell/script/tokenize.sh"
On running a script with dependencies, I got the following error,
"ambiguous redirect"
../../deter-4/bin/determine: No such file or directory
../../deter-4/bin/determine1: No such file or directory
Now, how can I tell to accept dependencies while running the shell script
I think your problem is the working directory. Try something like this:
cat input.txt | ssh clrg@192.168.2.22 "sh -c 'cd /path/to/shell/script; ./tokenize.sh'"
Your script seems to expect to be run from a specific working directory only. The error messages you mentioned in your comment about the relative paths (starting with ../../
) at least suggest that.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.