Re: Writing bytes to stdout reverses the bytes

2018-08-20 Thread Thomas Jollans
On 2018-08-20 17:07, Akkana Peck wrote: >> Thomas Jollans : >>> Wonderful. Now why don't we all forget about hexdump and use xxd? ;-) > > Marko Rauhamaa writes: >> Fedora: >> >>$ xxd >>bash: xxd: command not found >>$ hd >>bash: hd: command not found >>$ od -Ax -tx1z -v <<>

Re: Writing bytes to stdout reverses the bytes

2018-08-20 Thread Akkana Peck
> Thomas Jollans : > > Wonderful. Now why don't we all forget about hexdump and use xxd? ;-) Marko Rauhamaa writes: > Fedora: > >$ xxd >bash: xxd: command not found >$ hd >bash: hd: command not found >$ od -Ax -tx1z -v <<00 68 65 6c 6c 6f 0a

Re: Writing bytes to stdout reverses the bytes

2018-08-20 Thread Grant Edwards
On 2018-08-20, Chris Angelico wrote: > On Mon, Aug 20, 2018 at 12:01 PM, Grant Edwards >> What do you mean "run it as hd"? >> [... Calling via 'hd' alias makes no difference ...] > Your system is different from mine, then. No doubt. :) > rosuav@sikorsky:~$ ls -l $(which hd) > lrwxrwxrwx 1 root

Re: Writing bytes to stdout reverses the bytes

2018-08-20 Thread Marko Rauhamaa
Thomas Jollans : > On 2018-08-20 04:22, Chris Angelico wrote: >> On Mon, Aug 20, 2018 at 12:01 PM, Grant Edwards >> wrote: >>> On 2018-08-20, Ben Bacarisse wrote: It is if you run it as hd. >>> What do you mean "run it as hd"? >>> I don't have an "hd" in my path. >> Your system is different

Re: Writing bytes to stdout reverses the bytes

2018-08-20 Thread Thomas Jollans
On 2018-08-20 04:22, Chris Angelico wrote: > On Mon, Aug 20, 2018 at 12:01 PM, Grant Edwards > wrote: >> On 2018-08-20, Ben Bacarisse wrote: >>> It is if you run it as hd. >> >> What do you mean "run it as hd"? >> >> I don't have an "hd" in my path. > > Your system is different from mine, then.

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Chris Angelico
On Mon, Aug 20, 2018 at 12:01 PM, Grant Edwards wrote: > On 2018-08-20, Ben Bacarisse wrote: >> Grant Edwards writes: >> >>> On 2018-08-20, Steven D'Aprano wrote: On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: > When I write bytes to stdout, why are they reversed?

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Grant Edwards
On 2018-08-20, Ben Bacarisse wrote: > Grant Edwards writes: > >> On 2018-08-20, Steven D'Aprano wrote: >>> On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: >>> When I write bytes to stdout, why are they reversed? >>> >>> Answer: they aren't, use hexdump -C. >> >> One might think t

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Chris Angelico
On Mon, Aug 20, 2018 at 11:31 AM, Grant Edwards wrote: > On 2018-08-20, Chris Angelico wrote: >> On Mon, Aug 20, 2018 at 11:12 AM, Grant Edwards >> wrote: >>> On 2018-08-20, Steven D'Aprano wrote: On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: > When I write bytes to st

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Ben Bacarisse
Grant Edwards writes: > On 2018-08-20, Steven D'Aprano wrote: >> On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: >> >>> When I write bytes to stdout, why are they reversed? >> >> Answer: they aren't, use hexdump -C. > > One might think that dumping out bytes in the correct order ought

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Grant Edwards
On 2018-08-20, Chris Angelico wrote: > On Mon, Aug 20, 2018 at 11:12 AM, Grant Edwards > wrote: >> On 2018-08-20, Steven D'Aprano wrote: >>> On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: >>> When I write bytes to stdout, why are they reversed? >>> >>> Answer: they aren't, use he

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Chris Angelico
On Mon, Aug 20, 2018 at 11:12 AM, Grant Edwards wrote: > On 2018-08-20, Steven D'Aprano wrote: >> On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: >> >>> When I write bytes to stdout, why are they reversed? >> >> Answer: they aren't, use hexdump -C. > > One might think that dumping out

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Grant Edwards
On 2018-08-20, Steven D'Aprano wrote: > On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: > >> When I write bytes to stdout, why are they reversed? > > Answer: they aren't, use hexdump -C. One might think that dumping out bytes in the correct order ought to be the default format for hexd

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Steven D'Aprano
On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote: > When I write bytes to stdout, why are they reversed? Answer: they aren't, use hexdump -C. Thanks to all replies! -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- h

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Cameron Simpson
On 20Aug2018 00:31, Steven D'Aprano wrote: When I write bytes to stdout, why are they reversed? [steve@ando ~]$ python2.7 -c "print('\xfd\x84\x04\x08')" | hexdump 000 84fd 0804 000a 005 [steve@ando ~]$ python3.5 -c "import sys; sys.stdout.buffer.write(b'\xfd \x84\x04\x08\n')" | hexdum

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Chris Angelico
On Mon, Aug 20, 2018 at 10:31 AM, Steven D'Aprano wrote: > When I write bytes to stdout, why are they reversed? > > [steve@ando ~]$ python2.7 -c "print('\xfd\x84\x04\x08')" | hexdump > 000 84fd 0804 000a > 005 > > [steve@ando ~]$ python3.5 -c "import sys; sys.stdout.buffer.write(b'\xfd > \

Re: Writing bytes to stdout reverses the bytes

2018-08-19 Thread Grant Edwards
On 2018-08-20, Steven D'Aprano wrote: > When I write bytes to stdout, why are they reversed? > > [steve@ando ~]$ python2.7 -c "print('\xfd\x84\x04\x08')" | hexdump > 000 84fd 0804 000a > 005 They aren't. You're being fooled by the default output format of hexdump. By default, it displa

Writing bytes to stdout reverses the bytes

2018-08-19 Thread Steven D'Aprano
When I write bytes to stdout, why are they reversed? [steve@ando ~]$ python2.7 -c "print('\xfd\x84\x04\x08')" | hexdump 000 84fd 0804 000a 005 [steve@ando ~]$ python3.5 -c "import sys; sys.stdout.buffer.write(b'\xfd \x84\x04\x08\n')" | hexdump 000 84fd 0804 000a 005 -- Steven