zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: ZSH Users <zsh-users@sunsite.dk>
Subject: Re: Are there "binary" variables?
Date: Fri, 02 Jun 2006 22:51:35 -0700	[thread overview]
Message-ID: <060602225135.ZM20992@torch.brasslantern.com> (raw)
In-Reply-To: <m3irnjccn4.fsf@jin.myrkraverk.com>

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% 


      parent reply	other threads:[~2006-06-03  5:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-03  0:21 Johann 'Myrkraverk' Oskarsson
2006-06-03  2:39 ` Philippe Troin
2006-06-03  2:41   ` Philippe Troin
2006-06-03  5:51 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=060602225135.ZM20992@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).