
10 Nov
2011
10 Nov
'11
12:07 p.m.
On 10 November 2011 13:13, Brett Pemberton <brett.pemberton@gmail.com> wrote:
Relying on ls in bash scripts is bad, from memory. It could be aliased to "ls -laF --color" for instance, breaking your script. Far better to just use: for filename in *.mp3 do
There are plenty of ways that parsing 'ls' output will result in breakage, new lines characters in file names being my personal favourite, it's covered pretty well here: http://mywiki.wooledge.org/ParsingLs I recommend anyone who's interested in ensuring they're writing robust and correct bash code read through as much of the guide as they can manage though: http://mywiki.wooledge.org/BashGuide Cheers, Dave