Say for example BGR color code is BBGGRR; to convert it into RGB format in bash shell:
The format is
This thing could also be used to convert big-endian to little-endian formats.
$ color="BBGGRR" $ echo ${color:4:2}${color:2:2}${color:0:2}
The format is
${variable:index:length}
This thing could also be used to convert big-endian to little-endian formats.
... for arbitrarily sized string representations of a number that's needed in little endian
ReplyDeleteecho 1234abcd | grep -o .. | tac | echo "$(tr -d '\n')"
cdab3412