unzip command fails in ssh

I'm trying to run a set of commands on a remote machine using ssh in a shell script. One of the commands is unzip. But when the execution reaches this command, the script fails with an error that unzip is not found. Below is the code and the error snippet.

sourceDir=$1 ; filename=$3 ; destDir=$2
ssh -l "$remoteuser" "$remotecomputer" "cd ${sourceDir} && cp -rf ${filename} ${destDir} && cd ${destDir} && unzip -o ${filename}" >>
out

sh: unzip: not found.

I have checked on the remote machine that unzip command exists. I also tried hardcoding the actual file's name as an argument to the unzip, with no luck! The error remains the same.
Any idea why am getting this error?

I think I figured the problem! The machine from where I'm running the script does not have unzip command. Hence the error!

I gave the entire path to unzip, that I got from the remote machine with the help of 'which unzip'. Therefore my script now looks like,

ssh -l "$remoteuser" "$remotecomputer" "cd ${sourceDir} && cp -rf ${filename} ${destDir} && cd ${destDir} && /opt/oracle/ormerck/product/10.2.0.4/bin/unzip -o ${filename}"

My only worry is whether the path to unzip will change from machine to machine. I don't want the path to unzip to be a part of my script. Any ideas as to how I can avoid this?

Pleae put code inside

 tags.



sourceDir=$1 ; filename=$3 ; destDir=$2
ssh -l "$remoteuser" "$remotecomputer" "cd ${sourceDir} && cp -rf ${filename} ${destDir} && cd ${destDir} && unzip -o ${filename}" >>
 out

sh: unzip: not found.

I have checked on the remote machine that unzip command exists. I also tried hardcoding the actual file's name as an argument to the unzip, with no luck! The error remains the same.
Any idea why am getting this error?
[/quote]

[indent]
If it can't find unzip, a path to its argument isn't going to help; try using the full path to unzip.

Make sure that the directory containing unzip is in your PATH on all machines.

The double ampersand (&&) ends the command on the local machine.
So the local machine sees and executes (or tries to execute) 4 commands: ssh, cp, cd and unzip.
Also, the out file is being created on the local macine.

You may be able to quote them so the local machine sees them as arguments and passes them along.
I think the remote will then see them as separators.

------------------
Update:
Never mind. Now that I have it in a code block, I see that you have the quotes in a place that should make it work.
I don't know why it doesn't work, unless as discussed, unzip isn't on the path on the remote machine.