Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: file names in arrays
- X-seq: zsh-users 9017
- From: zzapper <david@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: file names in arrays
- Date: Mon, 04 Jul 2005 13:06:04 +0100
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <j158c1pcrjsq040ej4efsa1nt6cp96vlar@xxxxxxx> <1050702205137.ZM4701@xxxxxxxxxxxxxxxxxxxxxxx>
- Sender: news <news@xxxxxxxxxxxxx>
On Sat, 02 Jul 2005 20:51:37 +0000, wrote:
>On Jun 30, 4:51pm, zzapper wrote:
>}
>} At the risk of being abused, RTFM etc etc
>}
>} Has anyone got a script where a number of file names resulting from
>} say a find/grep are loaded into an array.
>
>Go to http://www.zsh.org/cgi-bin/mla/wilma/users and search for "keeper".
>
>} And then this array is looped thru with a promt deciding what might
>} happen to these files, mv,rm,cp edit etc
>
>Isn't the answer to this the same as -- or awfully similar to, at any
>rate -- the answer to your "Creating a Case statement dynamically"
>thread from a couple of days earlier?
>
>
> local file command target
> find "$@" | keep
> for file in $kept
> do
> PS3="Action on $file: "
> target=''
> select command in mv cp rm gvim
> do
> case $REPLY in
> ((Q|q)*) break 2;;
> (<1->)
> case $command in
> (cp|mv) vared -e -p "$command $file " target &&
> [[ -n $target ]] && $command $file $target
> (?*) $command $file;;
> (*) break;;
> esac;;
> (*) break;;
> esac
> done
> done
Bart,
Yes it's similar to my previous thread, but hopefully more general. I'd found a useful solution, but
didn't use arrays, so I ended up repeating operations.
Your script above blows up for me on
pick3:17: parse error near `$command' (the vared line)
zsh 4.2.4 (i686-pc-cygwin)
--
zzapper
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
http://www.rayninfo.co.uk/tips/ vim, zsh & success tips
Messages sorted by:
Reverse Date,
Date,
Thread,
Author