Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: special characters in file names issue
- X-seq: zsh-users 29334
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: linuxtechguy@xxxxxxxxx
- Cc: zsh <zsh-users@xxxxxxx>
- Subject: Re: special characters in file names issue
- Date: Fri, 10 Nov 2023 06:04:26 +0100
- Archived-at: <https://zsh.org/users/29334>
- In-reply-to: <CA+rB6GLYBa3RMo+dDwk4FtdQ=HB_ix+g3UWqiVJ7ko6DAAVLdA@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CA+rB6GLYBa3RMo+dDwk4FtdQ=HB_ix+g3UWqiVJ7ko6DAAVLdA@mail.gmail.com>
On 11/10/23, Jim <linux.tech.guy@xxxxxxxxx> wrote:
> Hi everyone,
>
> Using scripts, looking to cleanup duplicate files even if named
> differently.
> The issue I ran into is when a file path contains parentheses. '(' or ')'
>
> Example File Name: Wallpapers/Web_downloads/05 (1).jpg
>
> The following is part of an anonymous function:
>
> local E
> local -a AllFileNames
> local -A FileNameCkSum
> ...
> for E (${(@)AllFileNames}) {
> [[ -v FileNameCkSum[$E] ]] || FileNameCkSum[$E]=${$(shasum -a 1 $E)[1]} }
> # line that fails
> ...
>
> AllFileName contains the result of a glob statement.
>
> Error Message: (anon):<line no>: invalid subscript
>
> I'm sure this is a quoting issue, but everything I've tried so far has
> failed.
>
> If someone could point me to documentation or examples it would be
> appreciated.
The code you posted works fine (although it would be appreciated if
you posted actually runnable minimal test cases, rather than
excerpts).
PS gmail flagged your mail as spam, possibly because your From: and
Reply-to: headers contain different addresses.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author