zsh-users
 help / color / mirror / code / Atom feed
* zmv, case insensivity and possible the lack of coffee
@ 2015-08-08  5:43 Meino.Cramer
  2015-08-08  6:15 ` Eric Cook
  2015-08-08 11:01 ` Jun T.
  0 siblings, 2 replies; 4+ messages in thread
From: Meino.Cramer @ 2015-08-08  5:43 UTC (permalink / raw)
  To: zsh-users

Hi,

To sanitize some odd filenames I wrote a script like this

    #! /bin/zsh
    detox '*=\ *'
    zmv '(*)OddString(*)' '$1$2'
    zmv '(*)oddstring(*)' '$1$2'

In a hurry I didn't found a hint to make the regular expression for the
zmv command case insensitive (looked through man zshall).

So I put the two possibilities into two commands.
It can happen that there is only one kind of affected files or both
kinds.

If even detox fails, the script fails none of the zmvs will be
executed.
If the first zmv failed the second will not be tried.

Adding all with && does not help, the script fails in any case.

Assuming I simply didnt drink enough coffe this morning (its quite too
hot for coffee) I nonetheless dare to ask the community to help even
this is in all probability a nooby question.

This morning I am too old...please help me think...

Thanks a lot for any help in advance!
Best regards
Meino








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

* Re: zmv, case insensivity and possible the lack of coffee
  2015-08-08  5:43 zmv, case insensivity and possible the lack of coffee Meino.Cramer
@ 2015-08-08  6:15 ` Eric Cook
  2015-08-08 11:01 ` Jun T.
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Cook @ 2015-08-08  6:15 UTC (permalink / raw)
  To: zsh-users

On 08/08/2015 01:43 AM, Meino.Cramer@gmx.de wrote:
> Hi,
> 
> To sanitize some odd filenames I wrote a script like this
> 
>     #! /bin/zsh
>     detox '*=\ *'
>     zmv '(*)OddString(*)' '$1$2'
>     zmv '(*)oddstring(*)' '$1$2'
> 

If you are just asking how to make oddstring case-insensitive.
zmv '(*)(#i)oddstring(*)' '$1$2' # would do it.
(#i) is a globbing flag found in zshexpn under filename generation.


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

* Re: zmv, case insensivity and possible the lack of coffee
  2015-08-08  5:43 zmv, case insensivity and possible the lack of coffee Meino.Cramer
  2015-08-08  6:15 ` Eric Cook
@ 2015-08-08 11:01 ` Jun T.
  2015-08-09  0:15   ` Bart Schaefer
  1 sibling, 1 reply; 4+ messages in thread
From: Jun T. @ 2015-08-08 11:01 UTC (permalink / raw)
  To: zsh-users


2015/08/08 14:43, meino.cramer@gmx.de wrote:
> If even detox fails, the script fails none of the zmvs will be
> executed.
> If the first zmv failed the second will not be tried.

Try putting 'set +e' at the beginning of the script:

#!/bin/zsh
set +e
detox ...

If this works, then I suspect you have 'set -e' (or 'setopt errexit')
somewhere in your startup scripts (/etc/zshenv or ~/.zshenv ?).


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

* Re: zmv, case insensivity and possible the lack of coffee
  2015-08-08 11:01 ` Jun T.
@ 2015-08-09  0:15   ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2015-08-09  0:15 UTC (permalink / raw)
  To: zsh-users

On Aug 8,  8:01pm, Jun T. wrote:
}
} Try putting 'set +e' at the beginning of the script:
} If this works, then I suspect you have 'set -e' (or 'setopt errexit')

Further, joining them with && would also have the effect of stopping
as soon as any of them failed (exited nonzero).

So I think "set +e" is the most likely solution.


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

end of thread, other threads:[~2015-08-09  0:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-08  5:43 zmv, case insensivity and possible the lack of coffee Meino.Cramer
2015-08-08  6:15 ` Eric Cook
2015-08-08 11:01 ` Jun T.
2015-08-09  0:15   ` 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).