On 04 Nov 2014 15:01, Jeffrey Bastian wrote: > +# check for CPU endianness > +TEST_ARCH=NULL > +ENDIAN=$(echo -n I | od -to2 2>/dev/null | > + awk '{print substr($2,6,1); exit}' 2>/dev/null)
interesting idea. there's a few issues with this code, but rather than get into that, why don't ew just rely on readelf and be done ? i don't think we want to maintain two code paths here. > + READELF=$(which readelf 2>/dev/null) > + ENDIAN=$($READELF -h $READELF 2>/dev/null | grep endian) > + if echo $ENDIAN | grep -q 'Data:.*big endian' ; then > + TEST_ARCH=MSB > + elif echo $ENDIAN | grep -q 'Data:.*little endian' ; then > + TEST_ARCH=LSB > + fi you can simplify this a bit: READELF=$(which readelf 2>/dev/null) case $(${READELF} -h ${READELF}) in *Data:*"big endian"*) TEST_ARCH=MSB ;; *Data:*"little endian"*) TEST_ARCH=LSB ;; *) <throw an error> ;; esac -mike
signature.asc
Description: Digital signature
------------------------------------------------------------------------------
_______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list