How to manipulate hexadecimal value in Bash?
问题 I have a variable with an hexadecimal value: in this example, a byte with value 0xfe: echo $MYVAR | hexdump 0000000 0afe 0000002 I want to use this value on my bash script, in particular I need to: use as a string (echo X$MYVAR should give me Xfe) increment it, (0xff) convert back to the original format (I need to save the incremented value for future use) Maybe it would be easier if I convert it into integer format? EDIT: here is how I initialize the var: printf "\xfe" | dd bs=1 of=tempfile