[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sheflug] Annoying bash problem



And Lo! The Great Prophet "Chris J" uttered these words of wisdom:
> 
> 	ls | while read fname
> 	do
> 		echo "Processing $i ..."
> 		echo "<a href=\"$i\">$i</a></br>"
> 	done
> 

Bonus points if you spotted the deliberate mistake in this script. Er, 
change $i to $fname, or the read fname to read i :)

Does help when variable names match up ...

Oh also, spaces really ought to be translated into %20 in the link, summat
like:
	link=`echo $i | sed 's/ /%20/g'`
then remember to say $link in the href :)

Chris...


___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

  GNU the choice of a complete generation.