I want to generate a file with a range of binary bytes. As an example, the script below writes the bytes 0x00 thru 0xff, with each byte followed by 0x0a (line feed):
Code:
#!/bin/bash
#this crude little script writes 0x00 thru 0xff to a file
rm hexfile 2>/dev/null
for i in {0..15}; do
for j in {0..15}; do
hex=`printf "%x" $i``printf "%x" $j`
printf "\x$hex\n" >>hexfile
done
done
The question is: Is there an easier way to do this?