How to write a binary file using Bash?

后端 未结 6 1862
迷失自我
迷失自我 2021-02-05 05:46

My problem is that I need to create a file with this exact bytes: 48, 00, 49, 00.

I cannot use C, perl, other scripting language (the target is an embedded

6条回答
  •  故里飘歌
    2021-02-05 06:43

    you could try echo, that also allows arbitrary ascii chars (those numbers are octal numbers).

    echo -n -e \\0060\\0000\\0061\\0000  | hexdump
    

提交回复
热议问题