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

special characters in file names issue



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.

Regards,

Jim Murphy


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