LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-21-2004, 03:10 PM   #1
Jerk-0
LQ Newbie
 
Registered: Mar 2004
Posts: 3

Rep: Reputation: 0
Question Problem with unzip


Hi !!
I´m new to scripting (bash), and have run into an error msg I don´t understand...
Part of the code:
--------------------------------------------------------------
`unzip $1´
--------------------------------------------------------------

This unzips a zip-file.. so far so good BUT I get the following error:
Archive: Command not found

Why?? It works.. it unzips the file.. but why do I get the error msg??

Can someone plz explain this....
 
Old 03-21-2004, 03:24 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Could you paste bigger part of the code?
 
Old 03-21-2004, 03:47 PM   #3
Jerk-0
LQ Newbie
 
Registered: Mar 2004
Posts: 3

Original Poster
Rep: Reputation: 0
#!/bin/sh
echo "Welcome... I´m desingend to handle your files"
for fil in $1
do
case ${fil##*.} in

gz)
echo "this file is a gzip-file, decompressing it"
`gunzip $1`
;;
bz2)
echo "this file is a bzip2-file, decompressing it"
;;
z)
echo "this file is a zip-file, decompressing it"
`gunzip`
;;
*)
#else compress the file
echo "Plz choose a way to compress $1. (bzip2, gzip or zip)"
read choise
case $choise in
bzip2)
bzip2 $1
;;
gzip)
gzip $1
;;
zip)
zip $1
;;
esac
esac
done
 
Old 03-21-2004, 04:47 PM   #4
Jerk-0
LQ Newbie
 
Registered: Mar 2004
Posts: 3

Original Poster
Rep: Reputation: 0
That is my whole code... and it works perfectly except for the error msg I get when I decompress a .zip-file... but it does it anyways...

Does anyone understand why I get this msg?
 
Old 03-22-2004, 09:57 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I ran the code for a gzipped file. I didn't get an error. What happens if you manually decompress a file with gunzip?

I altered the program slightly to handle file names with spaces in them:

#!/bin/sh
echo "Welcome... I´m designed to handle your files"
fil="${1}"
case ${fil##*.} in

gz)
echo "this file is a gzip-file, decompressing it"
`gunzip "${fil}"`
;;
bz2)
echo "this file is a bzip2-file, decompressing it"
`bunzip2 "${fil}"`
;;
z)
echo "this file is a zip-file, decompressing it"
`gunzip`
;;
*)
#else compress the file
echo "Plz choose a way to compress "${fil}". (bzip2, gzip or zip)"
read choise
case $choise in
bzip2)
bzip2 "${fil}"
;;
gzip)
gzip "${fil}"
;;
zip)
zip "${fil}"
;;
esac
esac

Last edited by jschiwal; 03-22-2004 at 10:15 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem installing unzip Dragon, Interrupted Linux - Software 3 10-04-2005 07:19 PM
unzip Jeebizz Slackware 5 08-28-2005 04:07 AM
Unzip Jmcatch742 Linux - Software 4 08-01-2004 12:52 PM
Unzip PhuckFonix Linux - Newbie 1 05-30-2004 08:10 PM
unzip thanko Linux - Software 13 05-02-2003 05:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration