From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29207 invoked from network); 3 Jun 2006 02:39:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.2 (2006-05-25) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.2 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 3 Jun 2006 02:39:33 -0000 Received: (qmail 80054 invoked from network); 3 Jun 2006 02:39:27 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 3 Jun 2006 02:39:27 -0000 Received: (qmail 14360 invoked by alias); 3 Jun 2006 02:39:19 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10348 Received: (qmail 14350 invoked from network); 3 Jun 2006 02:39:19 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 3 Jun 2006 02:39:19 -0000 Received: (qmail 78844 invoked from network); 3 Jun 2006 02:39:19 -0000 Received: from tantale.fifi.org (64.81.251.130) by a.mx.sunsite.dk with SMTP; 3 Jun 2006 02:39:18 -0000 Received: (from phil@localhost) by tantale.fifi.org (8.9.3p2/8.9.3/Debian 8.9.3-21) id TAA08273; Fri, 2 Jun 2006 19:39:10 -0700 Sender: phil@fifi.org To: "Johann 'Myrkraverk' Oskarsson" Cc: ZSH Users Subject: Re: Are there "binary" variables? References: Mail-Copies-To: nobody From: Philippe Troin Date: 02 Jun 2006 19:39:09 -0700 In-Reply-To: Message-ID: <87lksfgdyq.fsf@tantale.fifi.org> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii "Johann 'Myrkraverk' Oskarsson" writes: > Is there a way to work with binary data in zsh? That is, more > specifically, is there a way to compare ^E to 5 and get true? Or > convert a character (say, ^E again) to its integer representation? Zsh's parameters are 8-bits clean. You could do the above with: typeset -A asc for i in {0..255}; do asc[$(print "\\$(([##8]$i))")]=$i;done var=$'\0\1\2\3' for i in $#var; do print "$i: $asc[$var[$i]]"; done Phil.