Re: echo: octal escapes dont work

[email protected] (Bob Proulx) Sun, 1 Dec 2002 11:44:57 -0700
Newsgroups gmane.comp.gnu.sh-utils.bugs
Message-ID <[email protected]>
Pigeon <[email protected]> [2002-11-30 19:24:44 +0000]:
> = So I do:
> 
> $ /bin/echo -ne \377 | hexd2
> 00000000: 33 37 37 
> $
> 
> = I should get 00000000: FF according to the above. Why don't I?
> = Other escape sequences give similar results. (eg \100)

I think you are getting confused by the shell.  The shell is reading
the line first and passing arguments to the command.  Try quoting the
argument to protect it from the shell.

  /bin/echo -ne '\377' | od -tx1

> $ /bin/echo --version
> echo (GNU sh-utils) 1.16

Hmm...  That is getting pretty old now.  Consider updating to a newer
version.  Getting to at least sh-utils 2.0.11 would be good.  Note
that sh-utils has been subsumed by coreutils in the newest packaging.

Bob