bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

printing byte value, bash differs from ksh/zsh


From: Tavis Ormandy
Subject: printing byte value, bash differs from ksh/zsh
Date: Mon, 9 Aug 2004 10:59:36 +0100
User-agent: Mutt/1.5.6i

Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib
-O2 -march=pentium4 -w -fomit-frame-pointer
uname output: Linux insomniac 2.6.7-grsec #3 SMP Sun Aug 8 14:02:22 BST
2004 i686 Intel(R) Pentium(R) 4 CPU 3.20GHz GenuineIntel GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 2.05b
Patch Level: 0
Release Status: release

Description:

I'm not sure if this is a bug, but I expected it to work how ksh and zsh
interpret it, bash's behaviour is a little strange...

I'm trying to get the hex value of bytes read in (using only builtins
would be nice, but i dont think it's going to work with bash). in ksh
this gives a nice list 0x01-0xff:

        for ((i=0;i<256;i++))
        do 
                eval tmp=`printf "$'\\\\\x%x'\n" $i`
        printf "%#1x\n" "'$tmp"
        done

instead of 0x00 I get 0, but as it only occurs once, I can test for it.

in bash I also get 0 for 0x7f (DEL), so I cant tell if it was a 0x00 or
a 0x7f, I also get a leading 0xffffffffffffff for 0x80-0xff, I'm not
sure where these are coming from!

-- 
-------------------------------------
address@hidden | finger me for my gpg key.
-------------------------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]