[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Sheflug] Annoying bash problem
Evening all,
I'm having a problem with some bash code which 3 of my friends can't
figure out either, so I'm hoping someone can put me out of my misery.
Basically, I'm trying to do a little 2-line script that autogenerates a
file listing with links for files.
This is the script in its test state:
for i in `ls *`
{
echo Processing file: \"$i\"
awk '{print "<a href="$i">"$i"</a><br>"}'
}
Problem is that $i is splitting on lines, spaces and tabs, no good as some
filenames have spaces in them. I tried IFS="\n" and IFS='\n' but it's
using n for splitting, not newline.
This is on FreeBSD 4.8-PRELEASE with bash2.05a - can anyone suggest where
we are all going wrong please?
TIA,
Jonathan
--
Jonathan Defries
jonathan@sirtis.org.uk
___________________________________________________________________
Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html
GNU the choice of a complete generation.