Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
zmv exits from function
- X-seq: zsh-users 29386
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: zmv exits from function
- Date: Sat, 30 Dec 2023 09:42:43 -0800
- Archived-at: <https://zsh.org/users/29386>
- List-id: <zsh-users.zsh.org>
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