Skip to content

Instantly share code, notes, and snippets.

@ErnyTech
Created December 30, 2017 15:17
Show Gist options
  • Save ErnyTech/465d2ee22d7cec11e8a836ed49548993 to your computer and use it in GitHub Desktop.
Save ErnyTech/465d2ee22d7cec11e8a836ed49548993 to your computer and use it in GitHub Desktop.
ihexarray=( $(find . -type f -name "*.ihex") )
for i in "${ihexarray[@]}"
do
out=$(echo $i | sed s/.ihex//)
xxd -r -p $i $out
perm=$(stat -c "%a" $i)
own=$(stat -c "%U:%G" $i)
chmod $perm $out
chown $own $out
mkdir ihex
mv $i ./ihex
done
hexarray=( $(find . -type f -name "*.HEX") )
for i in "${hexarray[@]}"
do
out=$(echo $i | sed s/.ihex//)
xxd -r -p $i $out
perm=$(stat -c "%a" $i)
own=$(stat -c "%U:%G" $i)
chmod $perm $out
chown $own $out
mkdir hex
mv $i ./hex
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment