I am using QNX to modify some files and then output some information abou those files. the process is similar to the following: find certain files in a directory if the names are less than a value perfomr dd command output file - info - staus
find $DIR -type n \( ! -iname "*sub*" \) -exec basename {} |
while read fname
do
if [ $(printf '%d\n' 0x$fname) -lt 31 ] #if file is < 31
then
dd bs=1 skip=67 count=1 if=/path/$fname/random of=/tmp/$fname
echo -n " "$fname" " #output file name
TEMP=$(</tmp/$fname) #temporary file is in
hd -A x /tmp/$fname | gawk '{printf $2}'
if [ $fname == 06 ]; then
COM="Testing on 06" # this is temporary
elif [ $fname == 08 ]; then
case "?? hex value of $2 ?? in
00) COM="DOWN" ;; #again, not sure what works
0x01) COM="UP" ;;
02) COM="Pass Through Mode" ;;
*) COM="ERROR" ;;
esac
else
if [[ $STATE = 0x00 ]]; then #doesn't work either
COM="DOWN"
elif [ "(hd -A x /tmp/$fname | gawk '{printf $2}')" == 0x01 ]; then
COM="UP"
else
COM="ERROR $STATE "
fi
fi
echo " " $COM
fi
done
I need a comparison to be able work between the hex value of the dd output and a hex digit, or even integer comparisons.