Colin Watson said: >> Took a couple of tries to get the syntax correct but I >> ended up with this: >> >> if [ `ls *.jpg 2>/dev/null|wc -l` -gt 0 ] >> >> then for i in *.jpg; do mmv "$i" `date +%s`-$a.jpg; a=a+1; done >> >> fi > > In general it's better to avoid putting backticks in the middle of ['s > arguments; it's just too fragile. Your arithmetic expansion looks a > bit > dodgy too. Extending my earlier mail, I'd use: > > export a=0 > find . -maxdepth 1 -name '*.jpg' -print | while read i; do > mmv "$i" "`date +%s`-$a.jpg" > a="$(($a+1))" > done > > -- > Colin Watson
I cut out a bit too much of the script in my example (the dodgy math is missing parts above it). I'm working on completing the bit I have and will re-thread this with a new message (and an explanation) in a bit. G -- Gerald http://www.phorce1.com http://www.buskatiers.org -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]