Skip to content

Commit

Permalink
feat: add nounset and pipefail bash options (#66)
Browse files Browse the repository at this point in the history
* feat: add nounset and pipefail options

* fix: unbound variable
  • Loading branch information
epiccurious authored Dec 18, 2023
1 parent b9dc848 commit 6a96222
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
6 changes: 4 additions & 2 deletions device_specific/flash_the_m5stack_core_basic
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/bash
set -e
set -o errexit
set -o nounset
set -o pipefail

cleanup() {
rm -rf -- "${temp_directory}"
if [ -n "${initial_tty_device_permissions}" ] &&
if [ -n "${initial_tty_device_permissions:-}" ] &&
[ "$(stat -c '%a' "${tty_device}")" != "${initial_tty_device_permissions}" ]; then
sudo chmod "${initial_tty_device_permissions}" "${tty_device}"
fi
Expand Down
6 changes: 4 additions & 2 deletions device_specific/flash_the_m5stack_fire
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/bash
set -e
set -o errexit
set -o nounset
set -o pipefail

cleanup() {
rm -rf -- "${temp_directory}"
if [ -n "${initial_tty_device_permissions}" ] &&
if [ -n "${initial_tty_device_permissions:-}" ] &&
[ "$(stat -c '%a' "${tty_device}")" != "${initial_tty_device_permissions}" ]; then
sudo chmod "${initial_tty_device_permissions}" "${tty_device}"
fi
Expand Down
6 changes: 4 additions & 2 deletions device_specific/flash_the_m5stack_m5stickc_plus
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/bash
set -e
set -o errexit
set -o nounset
set -o pipefail

cleanup() {
rm -rf -- "${temp_directory}"
if [ -n "${initial_tty_device_permissions}" ] &&
if [ -n "${initial_tty_device_permissions:-}" ] &&
[ "$(stat -c '%a' "${tty_device}")" != "${initial_tty_device_permissions}" ]; then
sudo chmod "${initial_tty_device_permissions}" "${tty_device}"
fi
Expand Down
6 changes: 4 additions & 2 deletions device_specific/flash_the_ttgo_tdisplay
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/bash
set -e
set -o errexit
set -o nounset
set -o pipefail

cleanup() {
rm -rf -- "${temp_directory}"
if [ -n "${initial_tty_device_permissions}" ] &&
if [ -n "${initial_tty_device_permissions:-}" ] &&
[ "$(stat -c '%a' "${tty_device}")" != "${initial_tty_device_permissions}" ]; then
sudo chmod "${initial_tty_device_permissions}" "${tty_device}"
fi
Expand Down
6 changes: 4 additions & 2 deletions flash_your_device
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/bash
set -e
set -o errexit
set -o nounset
set -o pipefail

cleanup() {
rm -rf -- "${temp_directory}"
if [ "${machine}" == "Linux" ] &&
[ -n "${initial_tty_device_permissions}" ] &&
[ -n "${initial_tty_device_permissions:-}" ] &&
[ "$(stat -c '%a' "${tty_device}")" != "${initial_tty_device_permissions}" ]; then
sudo chmod "${initial_tty_device_permissions}" "${tty_device}"
fi
Expand Down

0 comments on commit 6a96222

Please sign in to comment.