Skip to content

Robuster string parsing in bash script #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
"<path-to_elf.elf>"

Adding curly braces "${1]:e" ensures robust parsing.
  • Loading branch information
jackonelli committed Aug 21, 2020
commit a9dbd1651f2ebb910d34d8cbc753c2e2c776e3e9
2 changes: 1 addition & 1 deletion flash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"