LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem with unzip (https://www.linuxquestions.org/questions/linux-newbie-8/problem-with-unzip-160642/)

Jerk-0 03-21-2004 03:10 PM

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....

Mara 03-21-2004 03:24 PM

Could you paste bigger part of the code?

Jerk-0 03-21-2004 03:47 PM

#!/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

Jerk-0 03-21-2004 04:47 PM

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?

jschiwal 03-22-2004 09:57 PM

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


All times are GMT -5. The time now is 04:06 AM.