此命令将0xff在 Linux 中填充文件。
dd if=/dev/zero ibs=1k count=100 | tr "\000" "\377" >paddedFile.bin
Run Code Online (Sandbox Code Playgroud)
当我在 OSX 中运行它时,结果是不同的。
$ dd if=/dev/zero ibs=1k count=100 | tr "\000" "\377" >paddedFile.bin
100+0 records in
200+0 records out
102400 bytes transferred in 0.000781 secs (131104008 bytes/sec)
$ hexdump -C paddedFile.bin
00000000 c3 bf c3 bf c3 bf c3 bf c3 bf c3 bf c3 bf c3 bf
|................|
*
00032000
Run Code Online (Sandbox Code Playgroud)
这里发生了什么?