0

Using QNX, i'm creating a script that will list only hex valued files under 1F.

/path# ls
.               05              09              0B              pubsub09
..              07              09_sub          0E
04              08              0A              81
/path#

I have code that should list only hex values, but it still lists the whole directory.

ls /path/ |
while read fname 
do
  if [ "ibase=16; $fname" ]
  then
    echo "$fname"
  fi
done
return 0
Zombo
  • 1
  • 62
  • 391
  • 407

1 Answers1

0

Try this instead

if [[ $fname =~ ^[[:xdigit:]]+$ ]]
Zombo
  • 1
  • 62
  • 391
  • 407