Reputation: 3407
I am getting below error while running gzip command over ssh
ssh 123@HPUX "gzip"
ksh: gzip: not found
whereas if i am running tar in same way it is working properly.
ssh 123@HPUX "tar"
tar: usage tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile] [blocksize] [[-C directory] file] ...
Can you please suggest why am i getting this error and how can i overcome this problem ?
When i tried following step gzip is working properly
ssh 123@HPUX
gzip
gzip: compressed data not written to a terminal. Use -f to force compression.
For help, type: gzip -h
which means that gzip is working.
Upvotes: 1
Views: 2777
Reputation: 45115
Your $path
may be set differently for an interactive login session, versus
executing a single command via ssh. Does it work if you specify an absolute path to gzip?
Try logging in interactively, and use the command which gzip
to show where the
binary is. Perhaps it's something like /usr/local/gnu/gzip . (You might want to do
echo $path
too, and make a note of it for comparison purposes.) Then try using
that path in your batch SSH command, i.e. ssh 123@HPUX "/usr/local/gnu/gzip"
to see
what happens. The command ssh 123@HPUX 'echo $path'
(note single quotes!) should tell you how your $path
is set in that context -- if you compare that to your interactive $path
, you'll probably see a difference that explains why gzip isn't found in the first version of your batch command.
Upvotes: 1
Reputation: 77089
Wild guess: it's ksh
raising the error the first time. When you do a full ssh login, are you using ksh
? Are you running any scripts that modify its path?
Upvotes: 0