Rewrite reflash.sh in bash for compatibility

This commit is contained in:
2026-07-10 21:10:45 +00:00
parent 6c09eed5da
commit 37f077d025
2 changed files with 4 additions and 7 deletions
+1 -1
View File
@@ -18,7 +18,7 @@
esphome esphome
esptool esptool
cc2538-bsl cc2538-bsl
zsh # for ./reflash.sh bash # for ./reflash.sh
]; ];
shellHook = '' shellHook = ''
+3 -6
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env zsh #!/usr/bin/env bash
# Build a full list of known esphome devices and # Build a full list of known esphome devices and
# - reflash them # - reflash them
# - reflash those that match $1 # - reflash those that match $1
@@ -8,9 +8,6 @@
set -e set -e
# Make $variable expand into multiple argv when unquoted.
set -o shwordsplit
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
command=$1 command=$1
shift shift
@@ -68,7 +65,7 @@ print_results_table() {
printf "\n%-70sSTATUS\n\n" "COMMAND" printf "\n%-70sSTATUS\n\n" "COMMAND"
for result_cmdline in "${flash[@]}"; do for result_cmdline in "${flash[@]}"; do
printf "%-70s" "$result_cmdline " printf "%-70s" "$result_cmdline "
if [ "${flash_result["$result_cmdline"]+placeholder}" ]; then if [[ -v flash_result["$result_cmdline"] ]]; then
echo "${flash_result["$result_cmdline"]}" echo "${flash_result["$result_cmdline"]}"
else else
echo "N/A" echo "N/A"
@@ -82,7 +79,7 @@ print_results_table() {
for cmdline in "${flash[@]}"; do for cmdline in "${flash[@]}"; do
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
if [[ "$cmdline" =~ "$1" ]]; then if [[ "$cmdline" =~ $1 ]]; then
:; :;
else else
flash_result["$cmdline"]=SKIPPED flash_result["$cmdline"]=SKIPPED