Unzip Help


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Unzip Help
# 1  
Old 07-13-2010
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-
# 2  
Old 07-13-2010
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?
# 3  
Old 07-13-2010
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-
# 4  
Old 07-13-2010
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?
# 5  
Old 07-13-2010
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-
# 6  
Old 07-13-2010
So. That's me officially confused (it doesn't take much Smilie)

Can you post the result of...

Code:
cat -n unpack.sh

and
Code:
od -c unpack.sh

(at least while I think of something useful to say!)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Unzip

Hi All, I am having an error with a zip . It is showing me the below error. I tried using zip and jar command all show me the same error. Not sure what is this error and why this is coming any help ? >>> jar -xvf 99999_zpd.zip extracted: 100793_ipd0000.001.gz extracted:... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies

2. Shell Programming and Scripting

Unzip a gz file

Please tell me the unix command how to unzip a gz file(say a qwe.gz) and the orginal gz file should remain intact. Thanks in advance (7 Replies)
Discussion started by: pranabpal
7 Replies

3. Shell Programming and Scripting

Unzip the .zip file without using unzip utility in UNIX

I have .zip file, i want to list all the files archived in the zip file. unzip utility is not working for me in unix. Please help me resolve this issue Thanks ganesh. (3 Replies)
Discussion started by: Ganesh L
3 Replies

4. SCO

Unzip

Hi, I have installed Unzip 5.3 on SCO Unix 5.05 Openserver and it successfully installs but when I go to unzip a file by using unzip <filename> I get ksh: unzip: not found . Any ideas?:o (1 Reply)
Discussion started by: twitchmaker
1 Replies

5. UNIX for Advanced & Expert Users

Unzip help

Hi, client is posting a zip file with named as "LM_SEEHERE_-_TMG_905678_20100504.zip". In zip file, inside we have 3 .csv files. how to unzip the file and client needs only "LM_SEEHERE_-_TMG_905678_20100504.csv" the other two files are products.csv,category.csv. They don't want these files... (2 Replies)
Discussion started by: kirankumar
2 Replies

6. Shell Programming and Scripting

How to Unzip a file using unzip utility for files zipped without zip utility ?

Hi, I need to zip/compress a data file and send to a vendor. The vendor does have only unzip utility and can accept only .ZIP files. I do not have zip utility in my server. How do I zip/compress the file so that it can be deflated using unzip command ? I tried gzip & compress commands, but... (1 Reply)
Discussion started by: Sabari Nath S
1 Replies

7. Shell Programming and Scripting

How to Unzip a .ZIP file in Unix without using unzip cmd..?????

Hi All I have ftped a .ZIP file (zipped using WinZip in Windows) to my Unix server (HP-UX). I don't have unzip cmd available in my curent Unix version Please let me know any cmd in UNIX (other than unzip) using which I can unzip this .ZIP file . Please elaborate on the commands aval and... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

8. UNIX for Dummies Questions & Answers

unzip!!!!!!

Hi, How to find the size of a zipfile after unzipping without unziping it? Pls let me know if anyone has idea abtit. Thanks (1 Reply)
Discussion started by: rags_s11
1 Replies

9. HP-UX

How to Unzip a .ZIP file in Unix without using unzip cmd..?????

Hi All I have ftped a .ZIP file (zipped using WinZip in Windows) to my Unix server (HP-UX). I don't have unzip cmd available in my curent Unix version Please let me know any cmd in UNIX (other than unzip) using which I can unzip this .ZIP file . Please elaborate on the commands aval and... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

10. UNIX for Advanced & Expert Users

unzip

Is there any way to uncompress files in winzip/pkzip format which contain mulitple members without using the "unzip" command? (9 Replies)
Discussion started by: keroppi
9 Replies
Login or Register to Ask a Question