0

I'm trying to pass an argument to ssh like so:

ssh user@host 'foo 2'

The problem is, foo is not defined on my host machine, only the server, and it gives me the error

sh: foo: not found

However, if I do

ssh user@host

$ foo 2

Then I get the expected output. How do I fix this?

Community
  • 1
  • 1
Pauly B
  • 111
  • 4
  • 1
    Use the absolute path – Ed Heal Apr 14 '16 at 17:27
  • 1
    yea yea... like `ssh user@host '/usr/bin/foo 2'`. Or whatever the path is to your `foo` program. [And check this out too](http://stackoverflow.com/questions/940533/how-do-i-set-path-such-that-ssh-userhost-command-works), since your issue is probably your `.bashrc` or whatever not running everything for your ssh's non-interactive shell, so the PATH variable doesn't get set and your non-interactive shell doesn't know where to find `foo` – JNevill Apr 14 '16 at 17:29

0 Answers0