Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

zmv exits from function



I'm using zmv to rename files in a directory tree recursively via a 'for' loop which visits each subdirectory.  It works fine if there are files found to rename, but if not, then the entire function crashes back to CL.  How can I persuade zmv to just let the function cycle to the next subdir?  I see no option that seems relevant.

Cut down to the essentials:

function global ()
{
    f ,dB >! /tmp/global_tmp    # My function.  Gives list of subdirs, works fine.
    curdir=$PWD
    for aa in $(cat /tmp/global_tmp); do     # For every line:

        cd $aa

        zmv '(*).SNT' '$1.eml'
        zmv '(*).MES' '$1.eml'

        cd $curdir
    done
}

Lots of other test commands in place of zmv cycle fine in case of no match, but zmv insists on returning.






Messages sorted by: Reverse Date, Date, Thread, Author