On 20 March 2015 at 01:12, Chris F.A. Johnson <ch...@cfajohnson.com> wrote:
> What does catrand do? Can it not be done with standard tools, e.g. awk? > > And that is almost always the wrong way to loop through filenames. > Done properly, you don't need to worry about spaces in filenames: Oh, I answered this quesion already in my initial posting: -- snipp -- For randomization I use a little CLI utility that I wrote ages ago: http://www.the-little-red-haired-girl.org/pub/linux/catrand-1.2-1.src.rpm - as it is the script will not work without it, but you may want to replace this by something else to create a shuffled list of the file names. Since it replaces newlines by spaces I can't really do any of those neat things allowing me to iterate over file names containing white spaces in my script, therefore all symlinks have normalised file names, i.e. without white spaces. -- snapp -- Please note what is said in the second paragraph. > Why are you using an external (i.e. slow) command. Use shell arithmetic: > > w=$(( w + 1 )) Because that's a bashism. I do shell scripting a lot, mostly for automatiing deployments. That's one reason I avoid bashisms - you don't want to check for the correct bash version each time you deploy your stuff somewhere. Since running bashisms on wrong bash versions can lead to things failing silently, my usual strategy is writing stuff that will even run o a Bourne shell. Unless you are writing code for embedded environments where process creation overhead can really hurt, the above code is totally fine. When doing real arithmetics you can always use bc :) Cheers, m. -- ---------- mdie...@gmail.com --/-- mar...@the-little-red-haired-girl.org ---- ------------- / http://herbert.the-little-red-haired-girl.org / ------------- -- To unsubscribe, send mail to wmaker-user-unsubscr...@lists.windowmaker.org.