Hi,
I have a requirement of calling command in bash script which takes 12 bytes string.
I need to send the below value in that string:
in hex each byte separated by : \x23,\x07,\0x01,\x00,\x80,\x00,\x00,\x00,\x00,\x00,\x00,\x00
i need to convert each of these hex values to ascii and form a 12 byte length string and send it as option to my command.
i tried this way:
bytes1=$(printf "\x23")
bytes2=$(printf "\x07")
bytes3=$(printf "\x01")
bytes4=$(printf "\x00")
bytes5=$(printf "\x80")
cmd=$(echo $bytes1$bytes2$bytes3$bytes4$bytes5$bytes4$bytes4$bytes4$bytes4$bytes4$bytes4$bytes4)
size=$(echo ${#cmd})
echo "string length= $size"
i get length as 4
Probably bytes having \x00 causing this problem. Could you please suggest and help me on it to create the correct string.
Thanks
deb