1#!/bin/bash 2# 3# Converts a big-endian hex string to a little-endian hex string. 4# 5# Examples: 6# 7# ./be_to_le.sh 0x12345678 8# 0x78563412 9# 10# ./be_to_le.sh 12345678 11# 0x78563412 12 13BE_VALUE=$1 14 15# If the input starts with 0x, strip it off. 16if [[ $BE_VALUE =~ ^0x.* ]]; 17then 18BE_VALUE=${BE_VALUE:2} 19fi 20 21echo 0x`echo -n $BE_VALUE | tac -rs ..` 22