From 9ce92fca1bdf39e6c52aedfb9b0fccdb45ff4083 Mon Sep 17 00:00:00 2001 From: Olivetti <1502093+Olivetti@users.noreply.github.com> Date: Wed, 18 Mar 2026 23:48:33 +0100 Subject: [PATCH 1/2] Refactor output formatting and device info retrieval Updated output formatting and improved variable handling for device information retrieval. --- fritzBoxShellTest.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/fritzBoxShellTest.sh b/fritzBoxShellTest.sh index 4d0a7ce..6b04197 100644 --- a/fritzBoxShellTest.sh +++ b/fritzBoxShellTest.sh @@ -22,12 +22,19 @@ declare -a minwords=(3 5 3 5 9 1 counter=0 for i in "${services[@]}" do - echo -n "$i" "${actions[$counter]}" - words=$(/bin/bash "$DIRECTORY/fritzBoxShell.sh" "$i" "${actions[$counter]}"|wc -w) - #echo -n $words - [[ "$words" -ge ${minwords[$counter]} ]] && echo -e "\tis working!" || echo -e "\tis not working!" - counter=$((counter+1)) + printf "%-20s" "${i} ${actions[$counter]}" + words=$(/bin/bash "$DIRECTORY/fritzBoxShell.sh" "${i}" "${actions[$counter]}" | wc -w) + #echo -n $words + [[ "$words" -ge ${minwords[$counter]} ]] && echo "yes" || echo "no" + counter=$((counter+1)) done -/bin/bash "$DIRECTORY/fritzBoxShell.sh" DEVICEINFO 3 | grep NewModelName -/bin/bash "$DIRECTORY/fritzBoxShell.sh" DEVICEINFO 3 | grep NewSoftwareVersion -/bin/bash "$DIRECTORY/fritzBoxShell.sh" VERSION + +DI=$(/bin/bash "$DIRECTORY/fritzBoxShell.sh" DEVICEINFO 3) +for j in 'NewModelName' 'NewSoftwareVersion' +do + _DI=$(grep ${j} <<<${DI}) + printf "%-19s %s\n" "$(cut -d' ' -f1 <<<${_DI})" "$(cut -d' ' -f2- <<<${_DI})" +done + +VERS=$(/bin/bash "$DIRECTORY/fritzBoxShell.sh" VERSION) +printf "%-19s v%s\n" "$(cut -d' ' -f1 <<<${VERS})" "$(cut -d' ' -f3 <<<${VERS})" From 9e5732b05a564a8e6b8f036ca2142adeab9e12e9 Mon Sep 17 00:00:00 2001 From: Olivetti <1502093+Olivetti@users.noreply.github.com> Date: Thu, 19 Mar 2026 00:08:25 +0100 Subject: [PATCH 2/2] Refactor output formatting in fritzBoxShellTest.sh --- fritzBoxShellTest.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fritzBoxShellTest.sh b/fritzBoxShellTest.sh index 6b04197..32816f7 100644 --- a/fritzBoxShellTest.sh +++ b/fritzBoxShellTest.sh @@ -22,19 +22,19 @@ declare -a minwords=(3 5 3 5 9 1 counter=0 for i in "${services[@]}" do - printf "%-20s" "${i} ${actions[$counter]}" - words=$(/bin/bash "$DIRECTORY/fritzBoxShell.sh" "${i}" "${actions[$counter]}" | wc -w) - #echo -n $words - [[ "$words" -ge ${minwords[$counter]} ]] && echo "yes" || echo "no" - counter=$((counter+1)) + printf "%-20s" "${i} ${actions[$counter]}" + words=$(/bin/bash "$DIRECTORY/fritzBoxShell.sh" "${i}" "${actions[$counter]}" | wc -w) + #echo -n $words + [[ "$words" -ge ${minwords[$counter]} ]] && echo "yes" || echo "no" + counter=$((counter+1)) done - + DI=$(/bin/bash "$DIRECTORY/fritzBoxShell.sh" DEVICEINFO 3) for j in 'NewModelName' 'NewSoftwareVersion' do - _DI=$(grep ${j} <<<${DI}) - printf "%-19s %s\n" "$(cut -d' ' -f1 <<<${_DI})" "$(cut -d' ' -f2- <<<${_DI})" + _DI=$(grep ${j} <<<${DI}) + printf "%-19s %s\n" "$(cut -d' ' -f1 <<<${_DI})" "$(cut -d' ' -f2- <<<${_DI})" done - + VERS=$(/bin/bash "$DIRECTORY/fritzBoxShell.sh" VERSION) printf "%-19s v%s\n" "$(cut -d' ' -f1 <<<${VERS})" "$(cut -d' ' -f3 <<<${VERS})"