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.... |
Could you paste bigger part of the code?
|
#!/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 |
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? |
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. |