zsh-users
 help / color / mirror / code / Atom feed
* zmv exits from function
@ 2023-12-30 17:42 Ray Andrews
  2023-12-30 20:38 ` Bart Schaefer
  2023-12-30 22:34 ` Bart Schaefer
  0 siblings, 2 replies; 25+ messages in thread
From: Ray Andrews @ 2023-12-30 17:42 UTC (permalink / raw)
  To: Zsh Users

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.




^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2024-01-03 19:02 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-30 17:42 zmv exits from function Ray Andrews
2023-12-30 20:38 ` Bart Schaefer
2023-12-30 21:02   ` Ray Andrews
2023-12-30 22:21     ` Bart Schaefer
2023-12-30 21:15   ` Mikael Magnusson
2023-12-31  3:43     ` Ray Andrews
2023-12-31  3:58       ` Bart Schaefer
2023-12-31 15:53         ` Ray Andrews
2023-12-31 21:44           ` Bart Schaefer
2023-12-31 22:06             ` Ray Andrews
2024-01-02 14:51               ` Mark J. Reed
2024-01-02 17:01                 ` Ray Andrews
2024-01-02 11:50   ` Peter Stephenson
2024-01-02 17:08     ` Ray Andrews
2024-01-02 17:47       ` Mark J. Reed
2024-01-02 18:16         ` Ray Andrews
2024-01-02 20:24           ` Bart Schaefer
2024-01-02 21:32             ` Ray Andrews
2024-01-02 17:48       ` Peter Stephenson
2024-01-02 19:07         ` Bart Schaefer
2024-01-02 19:52           ` Ray Andrews
2024-01-03  9:55           ` Peter Stephenson
2024-01-03 15:46             ` Ray Andrews
2024-01-03 19:01               ` Bart Schaefer
2023-12-30 22:34 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).