Hello all.. I am baning my head against a bash script.. I have a load of .bz2 files in a directory (some 100 of them) And i want to decompress ALL of them to another directory. I thought a small script would do. cd /mnt/extra1/files for i in /home/lucifer/download do bunzip2 %i done But as i get to line 2 it burps me a bash: syntax error near unexpected token `bunzip2' what am i overlooking here????? -- /Rikard --------------------------------------------------------------------------------- Rikard Johnels email : rjhn@linux.nu mob : +46 70 464 99 39 --------------------------Public PGP fingerprint------------------------------ < 15 28 DF 78 67 98 B2 16 1F D3 FD C5 59 D4 B6 78 46 1C EE 56 >
On Wed, 2002-05-01 at 20:14, Rikard DustPuppy Johnels wrote:
cd /mnt/extra1/files for i in /home/lucifer/download do bunzip2 %i done
But as i get to line 2 it burps me a bash: syntax error near unexpected token `bunzip2'
Try this: cd /mnt/extra1/files for i in /home/lucifer/download/*.bz2; do bunzip2 $i done The shell expands "/home/lucifer/download/*.bz2" to the list of file names. The semi-colon tells Bash it's reached the end of the list. -- Robert Wohlfarth rjwohlfar@galaxyinternet.net "Is not life more important than food, and the body more important than clothes?" -- Matthew 6:25b
I don't know about your script, but if you want a very quick way to uncompress those files you could just do a 'tar jxvf *.bz2 -C /mnt/extra1/files' Maybe not what you're after,but very easy. HTH On Wed, 2002-05-01 at 18:14, Rikard DustPuppy Johnels wrote:
Hello all.. I am baning my head against a bash script.. I have a load of .bz2 files in a directory (some 100 of them) And i want to decompress ALL of them to another directory.
I thought a small script would do.
cd /mnt/extra1/files for i in /home/lucifer/download do bunzip2 %i done
But as i get to line 2 it burps me a bash: syntax error near unexpected token `bunzip2'
what am i overlooking here?????
--
/Rikard
--------------------------------------------------------------------------------- Rikard Johnels email : rjhn@linux.nu mob : +46 70 464 99 39
--------------------------Public PGP fingerprint------------------------------ < 15 28 DF 78 67 98 B2 16 1F D3 FD C5 59 D4 B6 78 46 1C EE 56 >
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com
-- Mark Doucette kranked@oberon.ark.com WinFree and Lovin' it. SuSE Rox Linux! Registered Linux User # 240512 ----////----
participants (3)
-
Mark Doucette
-
Rikard DustPuppy Johnels
-
Robert Wohlfarth