How to convert text to hexadecimal in bash script?
Example:
#!/bin/bash
myvar="abc '\\ special chars, etc..."
# need $myvar in hexadecimal: 616263...
I tried:
myvar=`printf $plaintext | xxd --p`
But does not works, $plaintext contain special chars by example
$plaintext='demo && evil command injected'
How to convert var into hex value safely? or can save buffer to variable like this?:
printf $abc | xxd --p | def=