Skip to content

Commit 15317f5

Browse files
authored
echo -ne
1 parent 1843f21 commit 15317f5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

misc/hexdump.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,11 @@ bash-3.2$ printf $'abc\0' | hexdump -C
5858
00000003
5959
```
6060
So it looks like using `printf 'abc\0'` is the best recipe for Bash on macOS. I'm not sure if Bash on other platforms differs.
61+
62+
Bill Mill [suggested](https://hachyderm.io/@llimllib/110413915366228318) `echo -ne` for this:
63+
```
64+
bash-3.2$ echo -ne 'abc\0' | hexdump -C
65+
00000000 61 62 63 00 |abc.|
66+
00000004
67+
```
68+
The `-e` option enables the interpretation of backslash escapes.

0 commit comments

Comments
 (0)