Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: .zshrc help...
- X-seq: zsh-users 5062
- From: Dan Nelson <dnelson@xxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: .zshrc help...
- Date: Mon, 17 Jun 2002 00:55:57 -0500
- In-reply-to: <20020617052841.GD30974@xxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20020617052841.GD30974@xxxxxxxxxxxxxxx>
In the last episode (Jun 16), Will Yardley said:
> FreeBSD's most recent release has changed the format for the LSCOLORS
> variable.
>
> with that in mind, i need some help adjusting my generic .zshrc.
>
> i currently use something like this (stolen from someone else) to adjust
> stuff based on my ZSH_VERSION:
>
> if [[ $ZSH_VERSION == 3.1.<5->* || $ZSH_VERSION == 3.<2->* ||
> $ZSH_VERSION == <4->* ]]; then
>
> i'd like to do something similar to this (in concept; obviously it has
> to be something more complex than this). a good (but simple)
> discsussion of the syntax above would also be helpful....
>
> if [ $(uname -r) <= 4.5 ]; then
> LSCOLORS="3x5x2x3x1x464301060203"
> elif [ $(uname -r) >= 4.6 ]; then
> LSCOLORS="dxfxBxcxbxegedabagacad"
> fi
You could use the is-at-least function (included with zsh 3.1.6 and
newer):
autoload -U is-at-least
if is-at-least 4.6 $OSTYPE ; then
# new style
LSCOLORS="dxfxBxcxbxegedabagacad"
else
# Old Style
LSCOLORS="3x5x2x3x1x464301060203"
fi
The syntax in the ZSH_VERSION test you pasted uses numeric range globs.
<-> matches any number, <3-> matches the number 3 and higher, etc.
That test could have been written more simply:
if is-at-least 3.1.5 ; then
When passed one argument, is-at-least compares against $ZSH_VERSION.
--
Dan Nelson
dnelson@xxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author