Skip to main content

Posts

Showing posts with the label graphical menu in bash shell

GUI menus in bash shell script

#!/bin/bash #menu driven program to display memoryinfo and cpuinfo while true do dialog --menu "Choose one:" 10 30 3 1 MemoryInfo 2 CPUInfo 3 exit 2>op o=`cat op`    case $o in    1)cat /proc/meminfo>tmp       dialog --title "Memory Info" --textbox tmp 22 70;;      2)cat /proc/cpuinfo>tmp        dialog --title "CPU Info" --textbox tmp 22 70;;    3)clear        exit;;      esac done  #example 2 while true do  dialog --menu "Enter choice" 12 30 4 1 date 2 cal  3 ls 4 exit  2>op   o=`cat op`   case $o in   1)date >t     dialog --title "date" --textbox t 10 30;;   2) cal 01 2020 >t       dialog --title "calendar" --textbox t 15 40;;   3)ls >t       dialog --title "list of files" --textbox t 30 40;;   ...