From a9dbd1651f2ebb910d34d8cbc753c2e2c776e3e9 Mon Sep 17 00:00:00 2001 From: Jakob Lindqvist Date: Fri, 21 Aug 2020 09:09:08 +0200 Subject: [PATCH] Robuster string parsing in bash script In the `avrdude` call the elf-file input argument is used: "... -Uflash:w:$1:e". On some systems the "$1:e" is interpreted as the extension of this argument, i.e. only producing "elf" instead of the full "" Adding curly braces "${1]:e" ensures robust parsing. --- flash.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flash.sh b/flash.sh index 91e706a..2530c98 100755 --- a/flash.sh +++ b/flash.sh @@ -13,4 +13,4 @@ if [ "$#" -lt 1 ]; then fi sudo -u $USER cargo build -avrdude -q -C/etc/avrdude.conf -patmega328p -carduino -P/dev/ttyACM0 -D "-Uflash:w:$1:e" +avrdude -q -C/etc/avrdude.conf -patmega328p -carduino -P/dev/ttyACM0 -D "-Uflash:w:${1}:e"