On Tue, 2007-05-22 at 12:22 -0600, Byron Clark wrote:
> Assuming you don't have any spaces in the filenames, this should work in bash:
>
> for f in *.doc; do
> catdoc "${f}" > "${f%doc}txt"
> done
Actually, even if you do have spaces in the filenames it will still
work. Whether you meant to or not, you avoid a classic newbie mistake by
using "for f in *.doc" instead of "for f in $(ls *.doc)". Whether you
mean to or not, you also obeyed Stuart's Rule of Shell Variable
Referencing. (Namely, always put variable references in double quotes
unless you have a good reason not to.)
Although it should work fine, I can't help but point out some minor
style changes I would have made to your example.
for FILE in *.doc
do
catdoc "$FILE" > "${FILE/doc/txt}"
done
--
Stuart Jansen e-mail/jabber: [EMAIL PROTECTED]
google talk: [EMAIL PROTECTED]
"However beautiful the strategy, you should occasionally look at
the results." -- Winston Churchill
signature.asc
Description: This is a digitally signed message part
-------------------- BYU Unix Users Group http://uug.byu.edu/ The opinions expressed in this message are the responsibility of their author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG. ___________________________________________________________________ List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
