Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Are there "binary" variables?
- X-seq: zsh-users 10350
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: ZSH Users <zsh-users@xxxxxxxxxx>
- Subject: Re: Are there "binary" variables?
- Date: Fri, 02 Jun 2006 22:51:35 -0700
- In-reply-to: <m3irnjccn4.fsf@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <m3irnjccn4.fsf@xxxxxxxxxxxxxxxxxx>
On Jun 3, 12:21am, Johann 'Myrkraverk' Oskarsson wrote:
}
} specifically, is there a way to compare ^E to 5 and get true?
In the manual under "Arithmetic Evaluation", a few pages down:
An expression of the form `##X' where X is any character sequence such
as `a', `^A', or `\M-\C-x' gives the ASCII value of this character and
an expression of the form `#FOO' gives the ASCII value of the first
character of the value of the parameter FOO.
zsh% print $((##\C-e))
5
zsh% ((##\C-e == 5)) && print It is 5 || print It is not 5
It is 5
zsh%
In the manual under "Quoting":
A string enclosed between "$'" and "'" is processed the same way as the
string arguments of the print builtin, and the resulting string is
considered to be entirely quoted.
zsh% print $'\5' | cat -v
^E
zsh% ctrlE=$'\5'
zsh% print $((#ctrlE))
5
zsh%
Messages sorted by:
Reverse Date,
Date,
Thread,
Author