On Thursday 14 February 2008 05:41:23 David C. Rankin wrote:
Listmates,
I have run into a bash problem with a simple for loop I don't understand and would like input from the gurus to determine if the tldp documentation is in error or if it is me. Safe money says it's me, but here is the situation.
I am using example 9.1.2.2. from the following link to construct a simple for loop to extract a directory full of zip files:
http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_09_01.html
The example give is:
[carol@octarine ~/html] cat html2php.sh #!/bin/bash # specific conversion script for my html files to php LIST="$(ls *.html)" for i in "$LIST"; do NEWNAME=$(ls "$i" | sed -e 's/html/php/') cat beginfile > "$NEWNAME" cat "$i" | sed -e '1,25d' | tac | sed -e '1,21d'| tac >> "$NEWNAME" cat endfile >> "$NEWNAME" done
This is actually in a tutorial? Wow for i in *; do NEWNAME=${i%html}.php echo beginfile > "$NEWNAME" sed -e '1,25d.........
So I created the following:
#!/bin/bash LIST="$(ls *.zip)" for i in "$LIST"; do unzip $i -d /mnt/nemesis-cfg/home/samba/computer/software/fonts/extract echo "Unzipped: $i to ../extract" done exit 0
for i in *.zip; do unzip "$i" -d /mnt/nemesis-cfg/home/samba/computer/software/fonts/extract done You want to have the quotes around $i to guard against spaces in file names Anders -- Madness takes its toll -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org