summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2018-06-05 07:15:16 -0400
committeryenatch <yenatch@gmail.com>2018-06-05 07:15:16 -0400
commit1baea408e225ab4a2c01f0204384eee55e6afd06 (patch)
treeaa615fab5199581ced4bb1e237567a4c2662b602
parent2dd2ec97f1cbc5ba32f79535087d265610fa1dcb (diff)
sort_symfile: don't overwrite the symfile with an intermediate file
-rwxr-xr-xtools/sort_symfile.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/sort_symfile.sh b/tools/sort_symfile.sh
index 82fced560..896b8e973 100755
--- a/tools/sort_symfile.sh
+++ b/tools/sort_symfile.sh
@@ -1,4 +1,5 @@
#!/bin/sh
+TEMP_FILE=$(mktemp)
sed \
-e "s/^..:[0-3]/0_ROM0@&/g" \
-e "s/^..:[4-7]/1_ROMX@&/g" \
@@ -7,6 +8,6 @@ sed \
-e "s/^00:[C-D]/4_WRAM0@&/g" \
-e "s/^..:[D-D]/5_WRAMX@&/g" \
$1 \
-| sort -o $1
-TEMP_FILE=$(mktemp)
-sed -e "s/^.*@//g" $1 > $TEMP_FILE && mv $TEMP_FILE $1
+| sort -o $TEMP_FILE
+sed -e "s/^.*@//g" $TEMP_FILE > $1
+rm $TEMP_FILE