October 26, 2009

Unix Lesson for Today

Learned after much difficulty today that find(1) doesn’t actually spawn a shell, and as a result trying to use backticks doesn’t work in a find exec parameter. However, you can tell find to invoke a shell to get around it. This works.

find . -name "*.DBF" -print -exec sh -c 'dbf2mysql -h localhost -d mydatabase -t $(basename "$1" ".DBF") -c -v -P password -U username $1' {} {} \;

Unix Techie


Previous post
Video: Open Internet This is a really great video that explains in plain language why Net Neutrality is so vitally important. {% include embed/youtube.html
Next post
New Video Stingers (v2) A little over a year ago I created a handful of stingers to use on video content that I create. The stinger serves a bunch of purposes. On the