Need help understanding printf code in bash -


i'm working on project , don't have bash experience , need understanding following string. looked printf syntax didn't either. thanks!

 "\0\0\0\0\0\x9\x1\x10\0\0\0\01\02%b%b" 

help printf shows

%b expand backslash escape sequences in corresponding argument

so, example

 printf "\0\0\0\0\0\x9\x1\x10\0\0\0\01\02%b%b" '\1' '\xff' | xxd 

returns

00000000: 0000 0000 0009 0110 0000 0001 0201 ff    ............... 

i.e. %b%b interprets backslashes in given arguments , returns characters codes 01 , ff, respectively.


Comments