[colug-432] Gracefully Doing Nothing

Rick Hornsby richardjhornsby at gmail.com
Mon Jan 30 13:45:55 EST 2017


On January 30, 2017 at 12:37:07, Rick Hornsby (richardjhornsby at gmail.com)
wrote:




On January 30, 2017 at 11:57:53, jep200404 at columbus.rr.com (
jep200404 at columbus.rr.com) wrote:

How does one do nothing gracefully in a Bourne shell for loop?

A example that fails to do nothing gracefully follows.



...

An option that might be slightly less readable but could be done in fewer
lines (eliminates the explicit loop construct entirely) is to use `find`
with exec mv or xargs. I haven't tested this, so consider it metacode -

find . -name '^[a-z]*' -maxdepth 1 -exec mv "{}" "$prefix-{}" \;

Apologies - I was making the search part too complicated. `find` assumes
the ^ anchor automagically.

find . -name '[a-z]*' -maxdepth 1 -exec ...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20170130/e38b6465/attachment-0001.html 


More information about the colug-432 mailing list