Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Fun with zsh (Re: Associative array ordering (Re: Example function))
- X-seq: zsh-workers 5175
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Fun with zsh (Re: Associative array ordering (Re: Example function))
- Date: Tue, 2 Feb 1999 03:31:47 -0800
- In-reply-to: <199902020801.JAA08446@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <199902020801.JAA08446@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
On Feb 2, 9:01am, Sven Wischnowsky wrote:
} Subject: Re: Associative array ordering and selective unset (Re: Example f
}
} Bart Schaefer wrote:
}
} > Now change the assignment a little:
} >
} > map=('*.(gz|Z)' ': 1; zcat
} > '*.bz2' ': 2; bzip2 -dc'
} > '*.bz' ': 3; bzip -dc'
} > '*' ': 4; <')
}
} Hmm, I like this. For bigger arrays one would have to use `01' and so
} on, but this should be acceptible.
Somewhat off-topic, but how about this trick? (Where map is a plain array
this time.)
map=(
'(*.(gz|Z)) zcat'
'(*.bz2) bzip2 -dc'
'(*.bz) bzip -dc'
'(*) <'
)
eval 'for i do case $i in' ${(j( $i;; ))map} '$i;; esac done'
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author