I would like to make a program with dialog that shows my ComputerArchitecture. But i have some false outputs. This is my script:
#!/bin/bash
# ComputerArchitecture_interactive_dialog: an interactive dialog to see the ComputerArchitecture in a simple way.
DIALOG_CANCEL=1
DIALOG_ESC=255
HEIGHT=0
WIDTH=0
display_result() {
dialog --title "$1" \
--no-collapse \
--msgbox "$result" 0 0
}
while true; do
exec 3>&1
selection=$(dialog \
--backtitle "Computer Architecture list" \
--title "ComputerArchitectuur" \
--clear \
--cancel-label "Exit" \
--menu "Use [ENTER] to select:" $HEIGHT $WIDTH 4 \
"1" "Information about Processors and Cores" \
"2" "Information about RAM-memory" \
"3" "Information about connected drives and USB-devices" \
"4" "Inforamtion about the current load" \
2>&1 1>&3)
exit_status=$?
exec 3>&-
case $exit_status in
$DIALOG_CANCEL)
clear
echo "Program stopped."
exit
;;
$DIALOG_ESC)
clear
echo "Program closed." >&2
exit 1
;;
esac
case $selection in
0 )
clear
echo "Program stopped."
;;
1 )
result=$(echo "Processors and Cores"; lscpu)
display_result "Processors and Cores"
;;
2 )
result=$(echo "RAM"; dmicode --type 17)
display_result "RAM"
;;
3 )
result=$(echo "Connected drives and USB-devices";lsblk \lsusb)
display_result "Connected drives and USB-devices"
;;
4 )
result=$(echo "Current load"; top)
display_result "Current load"
;;
esac
done
and this is the false output:
Error: Expected 2 arguments, found only 1.
Use --help to list options.
set -xto the top of your script (below the hash bang) and find out what command is causing that error.