[plug] Bash scripting error with functions

Cameron Patrick cameron at patrick.wattle.id.au
Sun Jun 12 20:29:56 WST 2005


Onno Benschop wrote:

> So, apart from creating another separate script, how should I solve
> this?

If you're willing to have your script break on filenames containing
newlines and backslashes, you could replace xargs with a while loop:

    find $somewhere --funky-arguments -print | while read foo; do
        my_little_function "$foo"
    done

Some evilness with awk and `find -print0' could give you robustness in
the face of newlines.  Writing this is left as an exercise to the
reader :-)

Cameron.




More information about the plug mailing list