Passing binary data as arguments in bash

前端 未结 5 700
余生分开走
余生分开走 2020-12-14 16:32

I need to pass binary data to a bash program that accepts command line arguments. Is there a way to do this?

It\'s a program that accepts one argument:



        
5条回答
  •  情书的邮戳
    2020-12-14 17:10

    Use the $'' quote style:

    script $'\x02\xc5\xd8'
    

    Test:

    printf $'\x02\xc5\xd8' | hexdump -C
    00000000  02 c5 d8
    

提交回复
热议问题