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

Re: file names in arrays



zzapper <david@xxxxxxxxxx> writes:

> Hi,
> 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.
> 
> And then this array is looped thru with a promt deciding what might
> happen to these files, mv,rm,cp edit etc

a=(${(ps:\0:)"$(find /path -print0)"})
for i in $a
do
  while :
  do
    print -n "Frob $i? (y/n) "
    read r
    case $r in
      ([yY]) frob $i; break;;
      ([nN]) break;;
      (*)    print "invalid input";;
    esac
  done
done

You get the idea...
Phil.



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