Unzip Help

Hello All,

I am trying to write a shell script(linux) where it just unzips the abc.zip file in the same folder.

If I write unzip abc.zip in my shell script and try to run the shell script I am getting Error : ?Invalid command

But when I run the command unzip abc.zip at the command prompt it runs fine.

I checked my system and zip/unzip has been installed.

I really appreciate the help.

Thank you in advance.

Su-

Hi.

A little context could help:

1) What shell are you using (what is your default shell)?
2) Exactly what is the command line you use to run the script?
3) Can you show exactly the first line of your script plus the unzip line?
4) Can you show the command you run from the command line that works?

Hi scottn,

1) & 3) Follwoing is my unpack.sh file
--------------------
#!/bin/sh

fileName='abc.zip'
dataDirectory='/var/local/product'

unzip $dataDirectory/$fileName

-------------------

2) The command line used to run the script: ./unpack.sh

4) I use following syntax to run at command line

unzip abc.zip

Thank you.
Su-

Sorry for all the question, and no answers! The ?Invalid command error doesn't look like an sh error. What does echo $0 show?

Can you echo your PATH from the script before the unzip, and echo it from the command prompt, and run ls $(which sh)?

Did you also post your entire unpack.sh script?

Hi,

If I write echo $0 at the command prompt it gives me "bash". I tried changing the first line in my .sh file to #!/bin/bash but still gives me same error.

and If I write echo $0 in my .sh file, while executing it says ?Invalid command

Yes I have posted my entire .sh file as I am just trying to unzip write now.

Thank you.
Su-

So. That's me officially confused (it doesn't take much :D)

Can you post the result of...

cat -n unpack.sh

and

od -c unpack.sh

(at least while I think of something useful to say!)