python - Print "\x09", print 0x20, how to print 0x09 to STDOUT? -
i try print stdout 0x09 (horizontal tab) value, in perl, python or bash 0x09 replaced 0x20 (a space).
$ hexdump -c <<< $(perl -e 'print "a\x09b" ') 00000000  41 20 42 0a                                       |a b.| 00000004   same problem in bash:
$ hexdump -c <<< $(printf "a\x09b") 00000000  41 20 42 0a                                       |a b.| 00000004   it's possible print 0x09 value stdout?
it's entirely bash issue. specifically, it's bash bug can worked around follows:
                 +-------- add these ---------+                  |                            |                  v                            v $ hexdump -c <<< "$(perl -e 'print "a\x09b"' )" 00000000  41 09 42 0a                                       |a.b.| 00000004   alternatively,
# passed via stdin original. $ perl -e 'print "a\x09b"' | hexdump -c 00000000  41 09 42                                          |a.b| 00000003  # passed via file name. $ hexdump -c <( perl -e 'print "a\x09b"' ) 00000000  41 09 42                                          |a.b| 00000003      
Comments
Post a Comment