Weekly Edition Return to the Press page |
Graphics tricks from the Linux command line (IBM developerWorks)
IBM developerWorks shows
how to perform image manipulation using command-line tools. "The
command line tools discussed in this article are part of the excellent
ImageMagick suite, which ships with Red Hat Linux and is freely available
online. ImageMagick can also be accessed via C, C++, Perl, Python, Java,
and several other languages, which Linux programmers will
appreciate."
(Log in to post comments)
Useless use of ... Posted Jul 19, 2003 9:12 UTC (Sat) by sholden (guest, #7881) [Link] The article touches my pet hate of the week:for img in `ls *.jpg`A useless use of ls, and a way to get an unnecessary "argument list" to long error, and *strange* behaviour if there's a directory which matches *.jpg.
Useless use of ... Posted Jul 19, 2003 17:37 UTC (Sat) by piman (subscriber, #8957) [Link] Also, I think that breaks some shells if there are spaces in the filenames.
Useless use of ... Posted Jul 20, 2003 2:03 UTC (Sun) by sholden (guest, #7881) [Link] Breaks all shells I suspect (I don't know of a single shell that doesn't use whitespace as a token seperator - maybe there's a "torturesh" that doesn't)...
Useless use of ... Posted Jul 20, 2003 22:17 UTC (Sun) by mikal (guest, #8473) [Link] Given it's not an article on shell scripting, does that really matter? Sure,
find . -type f -name "*.jpg" -exec blah {} \;
Is more correct, but it's a lot harder for a newbie to read. I am also sure that the photographic composition of the examples in the article isn't perfect, but it's not an article about how to take a photo, and that is therefore not relevant either.
Useless use of ... Posted Jul 21, 2003 1:27 UTC (Mon) by orabidoo (guest, #6639) [Link] Nah, you just do:for i in *.jpg; do; whateveryouwant; done No need for ls or find. Long live shell globbing :)
Speaking of useless elements ... Posted Jul 21, 2003 13:42 UTC (Mon) by Peter (guest, #1127) [Link] for i in *.jpg; do; whateveryouwant; done Eh, be careful when pointing out eye motes. One of those semicolons doesn't belong. (Which semicolon? An exercise for the reader.)
Speaking of useless elements ... Posted Jul 21, 2003 18:05 UTC (Mon) by flewellyn (subscriber, #5047) [Link] Obviously, the one after the do. That won't do anything. It should just be: for i in *.jpg; do whateveryouwant; done Then all shall be happy and fluffy and wonderful.
Useless use of find -exec... Posted Jul 22, 2003 11:38 UTC (Tue) by Dom2 (guest, #458) [Link]
That's not more correct; you should be using xargs(1). :-) find . -name '*.jpg' | xargs blah The usual caveat about filenames with spaces in them requiring this instead: find . -name '*.jpg' -print0 | xargs -0 blah -Dom
Useless use of ... Posted Jul 25, 2003 3:42 UTC (Fri) by bignose (subscriber, #40) [Link] > The article touches my pet hate of the week:> for img in `ls *.jpg` Hah. You think *you've* got pet hates. I look at the above and think "yech, they're still using backquotes when $() is POSIX-compliant and clearer". I then have time left over to think "... and they're using .jpg instead of .jpeg as the file extension; the format is JPEG, not JPG, for crying out loud". *Then* I get to the semantics of what they're doing and complain about needlessly spawning 'ls'. :-)
|
Copyright © 2003, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.