Update main.sh

This commit is contained in:
tux 2025-02-26 19:03:07 +01:00
parent 59be5eddc9
commit 4163ca33fb

110
main.sh
View File

@ -1,54 +1,56 @@
#/bin/bash #/bin/bash
E='echo -e';e='echo -en';trap "R;exit" 2 PATH=$PATH:/usr/sbin
ESC=$( $e "\e")
TPUT(){ $e "\e[${1};${2}H";} E='echo -e';e='echo -en';trap "R;exit" 2
CLEAR(){ $e "\ec";} ESC=$( $e "\e")
CIVIS(){ $e "\e[?25l";} TPUT(){ $e "\e[${1};${2}H";}
DRAW(){ $e "\e%@\e(0";} CLEAR(){ $e "\ec";}
WRITE(){ $e "\e(B";} CIVIS(){ $e "\e[?25l";}
MARK(){ $e "\e[7m";} DRAW(){ $e "\e%@\e(0";}
UNMARK(){ $e "\e[27m";} WRITE(){ $e "\e(B";}
R(){ CLEAR ;stty sane;$e "\ec\e[37;44m\e[J";}; MARK(){ $e "\e[7m";}
HEAD(){ DRAW UNMARK(){ $e "\e[27m";}
for each in $(seq 1 13);do R(){ CLEAR ;stty sane;$e "\ec\e[37;44m\e[J";};
$E " x x" HEAD(){ DRAW
done for each in $(seq 1 13);do
WRITE;MARK;TPUT 1 5 $E " x x"
$E "BASH SELECTION MENU ";UNMARK;} done
i=0; CLEAR; CIVIS;NULL=/dev/null WRITE;MARK;TPUT 1 5
FOOT(){ MARK;TPUT 13 5 $E "BASH SELECTION MENU ";UNMARK;}
printf "ENTER - SELECT,NEXT ";UNMARK;} i=0; CLEAR; CIVIS;NULL=/dev/null
ARROW(){ read -s -n3 key 2>/dev/null >&2 FOOT(){ MARK;TPUT 13 5
if [[ $key = $ESC[A ]];then echo up;fi printf "ENTER - SELECT,NEXT ";UNMARK;}
if [[ $key = $ESC[B ]];then echo dn;fi;} ARROW(){ read -s -n3 key 2>/dev/null >&2
M0(){ TPUT 4 20; $e "Login info";} if [[ $key = $ESC[A ]];then echo up;fi
M1(){ TPUT 5 20; $e "Network";} if [[ $key = $ESC[B ]];then echo dn;fi;}
M2(){ TPUT 6 20; $e "Disk";} M0(){ TPUT 4 20; $e "Login info";}
M3(){ TPUT 7 20; $e "Routing";} M1(){ TPUT 5 20; $e "Network";}
M4(){ TPUT 8 20; $e "Time";} M2(){ TPUT 6 20; $e "Disk";}
M5(){ TPUT 9 20; $e "ABOUT ";} M3(){ TPUT 7 20; $e "Routing";}
M6(){ TPUT 10 20; $e "EXIT ";} M4(){ TPUT 8 20; $e "Time";}
LM=6 M5(){ TPUT 9 20; $e "ABOUT ";}
MENU(){ for each in $(seq 0 $LM);do M${each};done;} M6(){ TPUT 10 20; $e "EXIT ";}
POS(){ if [[ $cur == up ]];then ((i--));fi LM=6
if [[ $cur == dn ]];then ((i++));fi MENU(){ for each in $(seq 0 $LM);do M${each};done;}
if [[ $i -lt 0 ]];then i=$LM;fi POS(){ if [[ $cur == up ]];then ((i--));fi
if [[ $i -gt $LM ]];then i=0;fi;} if [[ $cur == dn ]];then ((i++));fi
REFRESH(){ after=$((i+1)); before=$((i-1)) if [[ $i -lt 0 ]];then i=$LM;fi
if [[ $before -lt 0 ]];then before=$LM;fi if [[ $i -gt $LM ]];then i=0;fi;}
if [[ $after -gt $LM ]];then after=0;fi REFRESH(){ after=$((i+1)); before=$((i-1))
if [[ $j -lt $i ]];then UNMARK;M$before;else UNMARK;M$after;fi if [[ $before -lt 0 ]];then before=$LM;fi
if [[ $after -eq 0 ]] || [ $before -eq $LM ];then if [[ $after -gt $LM ]];then after=0;fi
UNMARK; M$before; M$after;fi;j=$i;UNMARK;M$before;M$after;} if [[ $j -lt $i ]];then UNMARK;M$before;else UNMARK;M$after;fi
INIT(){ R;HEAD;FOOT;MENU;} if [[ $after -eq 0 ]] || [ $before -eq $LM ];then
SC(){ REFRESH;MARK;$S;$b;cur=`ARROW`;} UNMARK; M$before; M$after;fi;j=$i;UNMARK;M$before;M$after;}
ES(){ MARK;$e "ENTER = main menu ";$b;read;INIT;};INIT INIT(){ R;HEAD;FOOT;MENU;}
while [[ "$O" != " " ]]; do case $i in SC(){ REFRESH;MARK;$S;$b;cur=`ARROW`;}
0) S=M0;SC;if [[ $cur == "" ]];then R;$e "\n$(w )\n";ES;fi;; ES(){ MARK;$e "ENTER = main menu ";$b;read;INIT;};INIT
1) S=M1;SC;if [[ $cur == "" ]];then R;$e "\n$(ifconfig )\n";ES;fi;; while [[ "$O" != " " ]]; do case $i in
2) S=M2;SC;if [[ $cur == "" ]];then R;$e "\n$(df -h )\n";ES;fi;; 0) S=M0;SC;if [[ $cur == "" ]];then R;$e "\n$(w )\n";ES;fi;;
3) S=M3;SC;if [[ $cur == "" ]];then R;$e "\n$(route -n )\n";ES;fi;; 1) S=M1;SC;if [[ $cur == "" ]];then R;$e "\n$(ifconfig )\n";ES;fi;;
4) S=M4;SC;if [[ $cur == "" ]];then R;$e "\n$(date )\n";ES;fi;; 2) S=M2;SC;if [[ $cur == "" ]];then R;$e "\n$(df -h )\n";ES;fi;;
5) S=M5;SC;if [[ $cur == "" ]];then R;$e "\n$($e by oTo)\n";ES;fi;; 3) S=M3;SC;if [[ $cur == "" ]];then R;$e "\n$(route -n )\n";ES;fi;;
6) S=M6;SC;if [[ $cur == "" ]];then R;exit 0;fi;; 4) S=M4;SC;if [[ $cur == "" ]];then R;$e "\n$(date )\n";ES;fi;;
esac;POS;done 5) S=M5;SC;if [[ $cur == "" ]];then R;$e "\n$($e by oTo)\n";ES;fi;;
6) S=M6;SC;if [[ $cur == "" ]];then R;exit 0;fi;;
esac;POS;done