A set of libraries like ncurses in a shell scriptBest way to create table-like CLI display in Bash?Escape...
Did the British navy fail to take into account the ballistics correction due to Coriolis force during WW1 Falkland Islands battle?
What is the appropriate benchmark for a Long/Short VIX futures strategy?
Was Tuvok bluffing when he said that Voyager's transporters rendered the Kazon weapons useless?
Avoiding racist tropes in fantasy
Check in to 2 hotels at same location
What brought these couples together?
LeetCode: Pascal's Triangle C#
Why did this happen to Thanos's ships at the end of "Avengers: Endgame"?
Why aren't RCS openings an issue for spacecraft heat shields?
The teacher logged me in as administrator for doing a short task, is the whole system now compromised?
What is wrong about this application of Kirchhoffs Current Law?
Why did MS-DOS applications built using Turbo Pascal fail to start with a division by zero error on faster systems?
How to avoid using System.String with Rfc2898DeriveBytes in C#
Would it be possible to have a GMO that produces chocolate?
Was Switzerland really impossible to invade during WW2?
Can pay be witheld for hours cleaning up after closing time?
Efficiently pathfinding many flocking enemies around obstacles
Is it possible to create a golf ball sized star?
Is a butterfly one or two animals?
Why can't an Airbus A330 dump fuel in an emergency?
Does an object count as "being moved" when placed in a Bag of Holding before its wielder moves, and then after moving they take the object out again?
Science fiction short story where aliens contact a drunk about Earth's impending destruction
Which household object drew this pattern?
Gamma GLM - Derive prediction intervals for new x_i
A set of libraries like ncurses in a shell script
Best way to create table-like CLI display in Bash?Escape sequences in output of script called from ncurses applicationUsing ncurses for basic GUI on a process started inside an init scriptLimiting System Libraries that an Program Can UseHow can I use terminfo entries on FreeBSD?How to determine if script is called by interactive shell or another script?How to execute commands sequentially emulating a user at terminal using a shell scriptNested If Statements in Shell ScriptLinux terminal skipping some (repeating/whitespace) charactersconvert ncurses binary dump into textResize window in multi-thread ncurses program
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Supose you present the following TUI
in the shell:
I need a set of libraries that can be used in the shell to do it. Being sure, ncurses
has not been used, because it make a dependecy.
Question: How to build the widget/window or another TUI
in the shell?
shell-script ncurses terminfo
add a comment |
Supose you present the following TUI
in the shell:
I need a set of libraries that can be used in the shell to do it. Being sure, ncurses
has not been used, because it make a dependecy.
Question: How to build the widget/window or another TUI
in the shell?
shell-script ncurses terminfo
There's acurses
module forzsh
. Here's a quick demo: zsh.org/mla/users/2019/msg00317.html
– Kusalananda♦
2 days ago
add a comment |
Supose you present the following TUI
in the shell:
I need a set of libraries that can be used in the shell to do it. Being sure, ncurses
has not been used, because it make a dependecy.
Question: How to build the widget/window or another TUI
in the shell?
shell-script ncurses terminfo
Supose you present the following TUI
in the shell:
I need a set of libraries that can be used in the shell to do it. Being sure, ncurses
has not been used, because it make a dependecy.
Question: How to build the widget/window or another TUI
in the shell?
shell-script ncurses terminfo
shell-script ncurses terminfo
edited Sep 13 '14 at 14:40
PersianGulf
asked Sep 13 '14 at 14:18
PersianGulfPersianGulf
7,3354 gold badges37 silver badges64 bronze badges
7,3354 gold badges37 silver badges64 bronze badges
There's acurses
module forzsh
. Here's a quick demo: zsh.org/mla/users/2019/msg00317.html
– Kusalananda♦
2 days ago
add a comment |
There's acurses
module forzsh
. Here's a quick demo: zsh.org/mla/users/2019/msg00317.html
– Kusalananda♦
2 days ago
There's a
curses
module for zsh
. Here's a quick demo: zsh.org/mla/users/2019/msg00317.html– Kusalananda♦
2 days ago
There's a
curses
module for zsh
. Here's a quick demo: zsh.org/mla/users/2019/msg00317.html– Kusalananda♦
2 days ago
add a comment |
2 Answers
2
active
oldest
votes
Okay, I feel like you might be asking one of two questions, so I will try to answer both.
What libraries can one use to create ncurses like interfaces for shell scripts?
Actually, I would never have recommended ncurses directly for shell scripts anyway since it's really not meant to be used by shell languages. Instead, I would recommend
dialog
. Dialog is a shim library which sits between ncurses and the shell making its use much simpler.
This would functionally give you two dependencies (one on
ncurses
and one ondialog
) which you seem to be against for some reason.
Given that I don't want any external dependencies, how can I create my own ncurses-like TUI library?
This is way outside the scope of *nix.SE. Creating a new TUI library is not going to be trivial (particularly if you're trying to create it in pure shell). There have been plenty of projects to attempt making new libraries to replace some of the use of ncurses (e.g.,
termbox
is one of the more successful ones).
If you intend to create your own library, you may want to look at the lower-level projects like ncurses and termbox and higher-level projects like dialog. Looking at their work might give you an idea of how to get started.
A final recommendation:
Dependencies on external projects, though they require some extra work (for integration and support), are not a bad thing. It means that you can focus only on the tool you want to make and leave the ground-work to those doing the lower infrastructure. Linux, in particular out of the *nix platforms, has a long history of dependency interaction.
If your goal is to learn how the lower-level stuff is done, great go for it. If instead you're trying to make a tool that would benefit from such low level work, just depend on an external tool. You'll be happier and so will be everyone that looks at your code.
Thanks, 1. i'm not going create a new lib. 2. I'm not going make a dependency such as ncurses. 3. i checked, dialog dpeend on libncursesw5 . 4. I guess if i want to use same lib, i want to use Terminfo , May be i extract tasksel , or mysql-server packages, because they have preconfigure script and dont' have any dependency. anyway thank you.
– PersianGulf
Sep 14 '14 at 10:49
I really don't understand why you're against depending on ncurses…
– HalosGhost
Sep 14 '14 at 18:32
ncurses one of stable library which exist is. But when terminfo is exist, Why make i a dependecy?
– PersianGulf
Sep 14 '14 at 19:43
I guess it depends on what you want to do. Doing things by-hand in terminfo can be a bit of a nightmare (though the same might be said of ncurses).
– HalosGhost
Sep 14 '14 at 19:45
1
Very likely terminfo on your system is a part of ncurses, in any case.
– Thomas Dickey
Mar 29 '15 at 1:00
add a comment |
#/bin/bash
E='echo -e';e='echo -en';trap "R;exit" 2
ESC=$( $e "e")
TPUT(){ $e "e[${1};${2}H";}
CLEAR(){ $e "ec";}
CIVIS(){ $e "e[?25l";}
DRAW(){ $e "e%@e(0";}
WRITE(){ $e "e(B";}
MARK(){ $e "e[7m";}
UNMARK(){ $e "e[27m";}
R(){ CLEAR ;stty sane;$e "ece[37;44me[J";};
HEAD(){ DRAW
for each in $(seq 1 13);do
$E " x x"
done
WRITE;MARK;TPUT 1 5
$E "BASH SELECTION MENU ";UNMARK;}
i=0; CLEAR; CIVIS;NULL=/dev/null
FOOT(){ MARK;TPUT 13 5
printf "ENTER - SELECT,NEXT ";UNMARK;}
ARROW(){ read -s -n3 key 2>/dev/null >&2
if [[ $key = $ESC[A ]];then echo up;fi
if [[ $key = $ESC[B ]];then echo dn;fi;}
M0(){ TPUT 4 20; $e "Login info";}
M1(){ TPUT 5 20; $e "Network";}
M2(){ TPUT 6 20; $e "Disk";}
M3(){ TPUT 7 20; $e "Routing";}
M4(){ TPUT 8 20; $e "Time";}
M5(){ TPUT 9 20; $e "ABOUT ";}
M6(){ TPUT 10 20; $e "EXIT ";}
LM=6
MENU(){ for each in $(seq 0 $LM);do M${each};done;}
POS(){ if [[ $cur == up ]];then ((i--));fi
if [[ $cur == dn ]];then ((i++));fi
if [[ $i -lt 0 ]];then i=$LM;fi
if [[ $i -gt $LM ]];then i=0;fi;}
REFRESH(){ after=$((i+1)); before=$((i-1))
if [[ $before -lt 0 ]];then before=$LM;fi
if [[ $after -gt $LM ]];then after=0;fi
if [[ $j -lt $i ]];then UNMARK;M$before;else UNMARK;M$after;fi
if [[ $after -eq 0 ]] || [ $before -eq $LM ];then
UNMARK; M$before; M$after;fi;j=$i;UNMARK;M$before;M$after;}
INIT(){ R;HEAD;FOOT;MENU;}
SC(){ REFRESH;MARK;$S;$b;cur=`ARROW`;}
ES(){ MARK;$e "ENTER = main menu ";$b;read;INIT;};INIT
while [[ "$O" != " " ]]; do case $i in
0) S=M0;SC;if [[ $cur == "" ]];then R;$e "n$(w )n";ES;fi;;
1) S=M1;SC;if [[ $cur == "" ]];then R;$e "n$(ifconfig )n";ES;fi;;
2) S=M2;SC;if [[ $cur == "" ]];then R;$e "n$(df -h )n";ES;fi;;
3) S=M3;SC;if [[ $cur == "" ]];then R;$e "n$(route -n )n";ES;fi;;
4) S=M4;SC;if [[ $cur == "" ]];then R;$e "n$(date )n";ES;fi;;
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
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f155417%2fa-set-of-libraries-like-ncurses-in-a-shell-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Okay, I feel like you might be asking one of two questions, so I will try to answer both.
What libraries can one use to create ncurses like interfaces for shell scripts?
Actually, I would never have recommended ncurses directly for shell scripts anyway since it's really not meant to be used by shell languages. Instead, I would recommend
dialog
. Dialog is a shim library which sits between ncurses and the shell making its use much simpler.
This would functionally give you two dependencies (one on
ncurses
and one ondialog
) which you seem to be against for some reason.
Given that I don't want any external dependencies, how can I create my own ncurses-like TUI library?
This is way outside the scope of *nix.SE. Creating a new TUI library is not going to be trivial (particularly if you're trying to create it in pure shell). There have been plenty of projects to attempt making new libraries to replace some of the use of ncurses (e.g.,
termbox
is one of the more successful ones).
If you intend to create your own library, you may want to look at the lower-level projects like ncurses and termbox and higher-level projects like dialog. Looking at their work might give you an idea of how to get started.
A final recommendation:
Dependencies on external projects, though they require some extra work (for integration and support), are not a bad thing. It means that you can focus only on the tool you want to make and leave the ground-work to those doing the lower infrastructure. Linux, in particular out of the *nix platforms, has a long history of dependency interaction.
If your goal is to learn how the lower-level stuff is done, great go for it. If instead you're trying to make a tool that would benefit from such low level work, just depend on an external tool. You'll be happier and so will be everyone that looks at your code.
Thanks, 1. i'm not going create a new lib. 2. I'm not going make a dependency such as ncurses. 3. i checked, dialog dpeend on libncursesw5 . 4. I guess if i want to use same lib, i want to use Terminfo , May be i extract tasksel , or mysql-server packages, because they have preconfigure script and dont' have any dependency. anyway thank you.
– PersianGulf
Sep 14 '14 at 10:49
I really don't understand why you're against depending on ncurses…
– HalosGhost
Sep 14 '14 at 18:32
ncurses one of stable library which exist is. But when terminfo is exist, Why make i a dependecy?
– PersianGulf
Sep 14 '14 at 19:43
I guess it depends on what you want to do. Doing things by-hand in terminfo can be a bit of a nightmare (though the same might be said of ncurses).
– HalosGhost
Sep 14 '14 at 19:45
1
Very likely terminfo on your system is a part of ncurses, in any case.
– Thomas Dickey
Mar 29 '15 at 1:00
add a comment |
Okay, I feel like you might be asking one of two questions, so I will try to answer both.
What libraries can one use to create ncurses like interfaces for shell scripts?
Actually, I would never have recommended ncurses directly for shell scripts anyway since it's really not meant to be used by shell languages. Instead, I would recommend
dialog
. Dialog is a shim library which sits between ncurses and the shell making its use much simpler.
This would functionally give you two dependencies (one on
ncurses
and one ondialog
) which you seem to be against for some reason.
Given that I don't want any external dependencies, how can I create my own ncurses-like TUI library?
This is way outside the scope of *nix.SE. Creating a new TUI library is not going to be trivial (particularly if you're trying to create it in pure shell). There have been plenty of projects to attempt making new libraries to replace some of the use of ncurses (e.g.,
termbox
is one of the more successful ones).
If you intend to create your own library, you may want to look at the lower-level projects like ncurses and termbox and higher-level projects like dialog. Looking at their work might give you an idea of how to get started.
A final recommendation:
Dependencies on external projects, though they require some extra work (for integration and support), are not a bad thing. It means that you can focus only on the tool you want to make and leave the ground-work to those doing the lower infrastructure. Linux, in particular out of the *nix platforms, has a long history of dependency interaction.
If your goal is to learn how the lower-level stuff is done, great go for it. If instead you're trying to make a tool that would benefit from such low level work, just depend on an external tool. You'll be happier and so will be everyone that looks at your code.
Thanks, 1. i'm not going create a new lib. 2. I'm not going make a dependency such as ncurses. 3. i checked, dialog dpeend on libncursesw5 . 4. I guess if i want to use same lib, i want to use Terminfo , May be i extract tasksel , or mysql-server packages, because they have preconfigure script and dont' have any dependency. anyway thank you.
– PersianGulf
Sep 14 '14 at 10:49
I really don't understand why you're against depending on ncurses…
– HalosGhost
Sep 14 '14 at 18:32
ncurses one of stable library which exist is. But when terminfo is exist, Why make i a dependecy?
– PersianGulf
Sep 14 '14 at 19:43
I guess it depends on what you want to do. Doing things by-hand in terminfo can be a bit of a nightmare (though the same might be said of ncurses).
– HalosGhost
Sep 14 '14 at 19:45
1
Very likely terminfo on your system is a part of ncurses, in any case.
– Thomas Dickey
Mar 29 '15 at 1:00
add a comment |
Okay, I feel like you might be asking one of two questions, so I will try to answer both.
What libraries can one use to create ncurses like interfaces for shell scripts?
Actually, I would never have recommended ncurses directly for shell scripts anyway since it's really not meant to be used by shell languages. Instead, I would recommend
dialog
. Dialog is a shim library which sits between ncurses and the shell making its use much simpler.
This would functionally give you two dependencies (one on
ncurses
and one ondialog
) which you seem to be against for some reason.
Given that I don't want any external dependencies, how can I create my own ncurses-like TUI library?
This is way outside the scope of *nix.SE. Creating a new TUI library is not going to be trivial (particularly if you're trying to create it in pure shell). There have been plenty of projects to attempt making new libraries to replace some of the use of ncurses (e.g.,
termbox
is one of the more successful ones).
If you intend to create your own library, you may want to look at the lower-level projects like ncurses and termbox and higher-level projects like dialog. Looking at their work might give you an idea of how to get started.
A final recommendation:
Dependencies on external projects, though they require some extra work (for integration and support), are not a bad thing. It means that you can focus only on the tool you want to make and leave the ground-work to those doing the lower infrastructure. Linux, in particular out of the *nix platforms, has a long history of dependency interaction.
If your goal is to learn how the lower-level stuff is done, great go for it. If instead you're trying to make a tool that would benefit from such low level work, just depend on an external tool. You'll be happier and so will be everyone that looks at your code.
Okay, I feel like you might be asking one of two questions, so I will try to answer both.
What libraries can one use to create ncurses like interfaces for shell scripts?
Actually, I would never have recommended ncurses directly for shell scripts anyway since it's really not meant to be used by shell languages. Instead, I would recommend
dialog
. Dialog is a shim library which sits between ncurses and the shell making its use much simpler.
This would functionally give you two dependencies (one on
ncurses
and one ondialog
) which you seem to be against for some reason.
Given that I don't want any external dependencies, how can I create my own ncurses-like TUI library?
This is way outside the scope of *nix.SE. Creating a new TUI library is not going to be trivial (particularly if you're trying to create it in pure shell). There have been plenty of projects to attempt making new libraries to replace some of the use of ncurses (e.g.,
termbox
is one of the more successful ones).
If you intend to create your own library, you may want to look at the lower-level projects like ncurses and termbox and higher-level projects like dialog. Looking at their work might give you an idea of how to get started.
A final recommendation:
Dependencies on external projects, though they require some extra work (for integration and support), are not a bad thing. It means that you can focus only on the tool you want to make and leave the ground-work to those doing the lower infrastructure. Linux, in particular out of the *nix platforms, has a long history of dependency interaction.
If your goal is to learn how the lower-level stuff is done, great go for it. If instead you're trying to make a tool that would benefit from such low level work, just depend on an external tool. You'll be happier and so will be everyone that looks at your code.
answered Sep 13 '14 at 18:09
HalosGhostHalosGhost
3,9139 gold badges22 silver badges36 bronze badges
3,9139 gold badges22 silver badges36 bronze badges
Thanks, 1. i'm not going create a new lib. 2. I'm not going make a dependency such as ncurses. 3. i checked, dialog dpeend on libncursesw5 . 4. I guess if i want to use same lib, i want to use Terminfo , May be i extract tasksel , or mysql-server packages, because they have preconfigure script and dont' have any dependency. anyway thank you.
– PersianGulf
Sep 14 '14 at 10:49
I really don't understand why you're against depending on ncurses…
– HalosGhost
Sep 14 '14 at 18:32
ncurses one of stable library which exist is. But when terminfo is exist, Why make i a dependecy?
– PersianGulf
Sep 14 '14 at 19:43
I guess it depends on what you want to do. Doing things by-hand in terminfo can be a bit of a nightmare (though the same might be said of ncurses).
– HalosGhost
Sep 14 '14 at 19:45
1
Very likely terminfo on your system is a part of ncurses, in any case.
– Thomas Dickey
Mar 29 '15 at 1:00
add a comment |
Thanks, 1. i'm not going create a new lib. 2. I'm not going make a dependency such as ncurses. 3. i checked, dialog dpeend on libncursesw5 . 4. I guess if i want to use same lib, i want to use Terminfo , May be i extract tasksel , or mysql-server packages, because they have preconfigure script and dont' have any dependency. anyway thank you.
– PersianGulf
Sep 14 '14 at 10:49
I really don't understand why you're against depending on ncurses…
– HalosGhost
Sep 14 '14 at 18:32
ncurses one of stable library which exist is. But when terminfo is exist, Why make i a dependecy?
– PersianGulf
Sep 14 '14 at 19:43
I guess it depends on what you want to do. Doing things by-hand in terminfo can be a bit of a nightmare (though the same might be said of ncurses).
– HalosGhost
Sep 14 '14 at 19:45
1
Very likely terminfo on your system is a part of ncurses, in any case.
– Thomas Dickey
Mar 29 '15 at 1:00
Thanks, 1. i'm not going create a new lib. 2. I'm not going make a dependency such as ncurses. 3. i checked, dialog dpeend on libncursesw5 . 4. I guess if i want to use same lib, i want to use Terminfo , May be i extract tasksel , or mysql-server packages, because they have preconfigure script and dont' have any dependency. anyway thank you.
– PersianGulf
Sep 14 '14 at 10:49
Thanks, 1. i'm not going create a new lib. 2. I'm not going make a dependency such as ncurses. 3. i checked, dialog dpeend on libncursesw5 . 4. I guess if i want to use same lib, i want to use Terminfo , May be i extract tasksel , or mysql-server packages, because they have preconfigure script and dont' have any dependency. anyway thank you.
– PersianGulf
Sep 14 '14 at 10:49
I really don't understand why you're against depending on ncurses…
– HalosGhost
Sep 14 '14 at 18:32
I really don't understand why you're against depending on ncurses…
– HalosGhost
Sep 14 '14 at 18:32
ncurses one of stable library which exist is. But when terminfo is exist, Why make i a dependecy?
– PersianGulf
Sep 14 '14 at 19:43
ncurses one of stable library which exist is. But when terminfo is exist, Why make i a dependecy?
– PersianGulf
Sep 14 '14 at 19:43
I guess it depends on what you want to do. Doing things by-hand in terminfo can be a bit of a nightmare (though the same might be said of ncurses).
– HalosGhost
Sep 14 '14 at 19:45
I guess it depends on what you want to do. Doing things by-hand in terminfo can be a bit of a nightmare (though the same might be said of ncurses).
– HalosGhost
Sep 14 '14 at 19:45
1
1
Very likely terminfo on your system is a part of ncurses, in any case.
– Thomas Dickey
Mar 29 '15 at 1:00
Very likely terminfo on your system is a part of ncurses, in any case.
– Thomas Dickey
Mar 29 '15 at 1:00
add a comment |
#/bin/bash
E='echo -e';e='echo -en';trap "R;exit" 2
ESC=$( $e "e")
TPUT(){ $e "e[${1};${2}H";}
CLEAR(){ $e "ec";}
CIVIS(){ $e "e[?25l";}
DRAW(){ $e "e%@e(0";}
WRITE(){ $e "e(B";}
MARK(){ $e "e[7m";}
UNMARK(){ $e "e[27m";}
R(){ CLEAR ;stty sane;$e "ece[37;44me[J";};
HEAD(){ DRAW
for each in $(seq 1 13);do
$E " x x"
done
WRITE;MARK;TPUT 1 5
$E "BASH SELECTION MENU ";UNMARK;}
i=0; CLEAR; CIVIS;NULL=/dev/null
FOOT(){ MARK;TPUT 13 5
printf "ENTER - SELECT,NEXT ";UNMARK;}
ARROW(){ read -s -n3 key 2>/dev/null >&2
if [[ $key = $ESC[A ]];then echo up;fi
if [[ $key = $ESC[B ]];then echo dn;fi;}
M0(){ TPUT 4 20; $e "Login info";}
M1(){ TPUT 5 20; $e "Network";}
M2(){ TPUT 6 20; $e "Disk";}
M3(){ TPUT 7 20; $e "Routing";}
M4(){ TPUT 8 20; $e "Time";}
M5(){ TPUT 9 20; $e "ABOUT ";}
M6(){ TPUT 10 20; $e "EXIT ";}
LM=6
MENU(){ for each in $(seq 0 $LM);do M${each};done;}
POS(){ if [[ $cur == up ]];then ((i--));fi
if [[ $cur == dn ]];then ((i++));fi
if [[ $i -lt 0 ]];then i=$LM;fi
if [[ $i -gt $LM ]];then i=0;fi;}
REFRESH(){ after=$((i+1)); before=$((i-1))
if [[ $before -lt 0 ]];then before=$LM;fi
if [[ $after -gt $LM ]];then after=0;fi
if [[ $j -lt $i ]];then UNMARK;M$before;else UNMARK;M$after;fi
if [[ $after -eq 0 ]] || [ $before -eq $LM ];then
UNMARK; M$before; M$after;fi;j=$i;UNMARK;M$before;M$after;}
INIT(){ R;HEAD;FOOT;MENU;}
SC(){ REFRESH;MARK;$S;$b;cur=`ARROW`;}
ES(){ MARK;$e "ENTER = main menu ";$b;read;INIT;};INIT
while [[ "$O" != " " ]]; do case $i in
0) S=M0;SC;if [[ $cur == "" ]];then R;$e "n$(w )n";ES;fi;;
1) S=M1;SC;if [[ $cur == "" ]];then R;$e "n$(ifconfig )n";ES;fi;;
2) S=M2;SC;if [[ $cur == "" ]];then R;$e "n$(df -h )n";ES;fi;;
3) S=M3;SC;if [[ $cur == "" ]];then R;$e "n$(route -n )n";ES;fi;;
4) S=M4;SC;if [[ $cur == "" ]];then R;$e "n$(date )n";ES;fi;;
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
add a comment |
#/bin/bash
E='echo -e';e='echo -en';trap "R;exit" 2
ESC=$( $e "e")
TPUT(){ $e "e[${1};${2}H";}
CLEAR(){ $e "ec";}
CIVIS(){ $e "e[?25l";}
DRAW(){ $e "e%@e(0";}
WRITE(){ $e "e(B";}
MARK(){ $e "e[7m";}
UNMARK(){ $e "e[27m";}
R(){ CLEAR ;stty sane;$e "ece[37;44me[J";};
HEAD(){ DRAW
for each in $(seq 1 13);do
$E " x x"
done
WRITE;MARK;TPUT 1 5
$E "BASH SELECTION MENU ";UNMARK;}
i=0; CLEAR; CIVIS;NULL=/dev/null
FOOT(){ MARK;TPUT 13 5
printf "ENTER - SELECT,NEXT ";UNMARK;}
ARROW(){ read -s -n3 key 2>/dev/null >&2
if [[ $key = $ESC[A ]];then echo up;fi
if [[ $key = $ESC[B ]];then echo dn;fi;}
M0(){ TPUT 4 20; $e "Login info";}
M1(){ TPUT 5 20; $e "Network";}
M2(){ TPUT 6 20; $e "Disk";}
M3(){ TPUT 7 20; $e "Routing";}
M4(){ TPUT 8 20; $e "Time";}
M5(){ TPUT 9 20; $e "ABOUT ";}
M6(){ TPUT 10 20; $e "EXIT ";}
LM=6
MENU(){ for each in $(seq 0 $LM);do M${each};done;}
POS(){ if [[ $cur == up ]];then ((i--));fi
if [[ $cur == dn ]];then ((i++));fi
if [[ $i -lt 0 ]];then i=$LM;fi
if [[ $i -gt $LM ]];then i=0;fi;}
REFRESH(){ after=$((i+1)); before=$((i-1))
if [[ $before -lt 0 ]];then before=$LM;fi
if [[ $after -gt $LM ]];then after=0;fi
if [[ $j -lt $i ]];then UNMARK;M$before;else UNMARK;M$after;fi
if [[ $after -eq 0 ]] || [ $before -eq $LM ];then
UNMARK; M$before; M$after;fi;j=$i;UNMARK;M$before;M$after;}
INIT(){ R;HEAD;FOOT;MENU;}
SC(){ REFRESH;MARK;$S;$b;cur=`ARROW`;}
ES(){ MARK;$e "ENTER = main menu ";$b;read;INIT;};INIT
while [[ "$O" != " " ]]; do case $i in
0) S=M0;SC;if [[ $cur == "" ]];then R;$e "n$(w )n";ES;fi;;
1) S=M1;SC;if [[ $cur == "" ]];then R;$e "n$(ifconfig )n";ES;fi;;
2) S=M2;SC;if [[ $cur == "" ]];then R;$e "n$(df -h )n";ES;fi;;
3) S=M3;SC;if [[ $cur == "" ]];then R;$e "n$(route -n )n";ES;fi;;
4) S=M4;SC;if [[ $cur == "" ]];then R;$e "n$(date )n";ES;fi;;
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
add a comment |
#/bin/bash
E='echo -e';e='echo -en';trap "R;exit" 2
ESC=$( $e "e")
TPUT(){ $e "e[${1};${2}H";}
CLEAR(){ $e "ec";}
CIVIS(){ $e "e[?25l";}
DRAW(){ $e "e%@e(0";}
WRITE(){ $e "e(B";}
MARK(){ $e "e[7m";}
UNMARK(){ $e "e[27m";}
R(){ CLEAR ;stty sane;$e "ece[37;44me[J";};
HEAD(){ DRAW
for each in $(seq 1 13);do
$E " x x"
done
WRITE;MARK;TPUT 1 5
$E "BASH SELECTION MENU ";UNMARK;}
i=0; CLEAR; CIVIS;NULL=/dev/null
FOOT(){ MARK;TPUT 13 5
printf "ENTER - SELECT,NEXT ";UNMARK;}
ARROW(){ read -s -n3 key 2>/dev/null >&2
if [[ $key = $ESC[A ]];then echo up;fi
if [[ $key = $ESC[B ]];then echo dn;fi;}
M0(){ TPUT 4 20; $e "Login info";}
M1(){ TPUT 5 20; $e "Network";}
M2(){ TPUT 6 20; $e "Disk";}
M3(){ TPUT 7 20; $e "Routing";}
M4(){ TPUT 8 20; $e "Time";}
M5(){ TPUT 9 20; $e "ABOUT ";}
M6(){ TPUT 10 20; $e "EXIT ";}
LM=6
MENU(){ for each in $(seq 0 $LM);do M${each};done;}
POS(){ if [[ $cur == up ]];then ((i--));fi
if [[ $cur == dn ]];then ((i++));fi
if [[ $i -lt 0 ]];then i=$LM;fi
if [[ $i -gt $LM ]];then i=0;fi;}
REFRESH(){ after=$((i+1)); before=$((i-1))
if [[ $before -lt 0 ]];then before=$LM;fi
if [[ $after -gt $LM ]];then after=0;fi
if [[ $j -lt $i ]];then UNMARK;M$before;else UNMARK;M$after;fi
if [[ $after -eq 0 ]] || [ $before -eq $LM ];then
UNMARK; M$before; M$after;fi;j=$i;UNMARK;M$before;M$after;}
INIT(){ R;HEAD;FOOT;MENU;}
SC(){ REFRESH;MARK;$S;$b;cur=`ARROW`;}
ES(){ MARK;$e "ENTER = main menu ";$b;read;INIT;};INIT
while [[ "$O" != " " ]]; do case $i in
0) S=M0;SC;if [[ $cur == "" ]];then R;$e "n$(w )n";ES;fi;;
1) S=M1;SC;if [[ $cur == "" ]];then R;$e "n$(ifconfig )n";ES;fi;;
2) S=M2;SC;if [[ $cur == "" ]];then R;$e "n$(df -h )n";ES;fi;;
3) S=M3;SC;if [[ $cur == "" ]];then R;$e "n$(route -n )n";ES;fi;;
4) S=M4;SC;if [[ $cur == "" ]];then R;$e "n$(date )n";ES;fi;;
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
#/bin/bash
E='echo -e';e='echo -en';trap "R;exit" 2
ESC=$( $e "e")
TPUT(){ $e "e[${1};${2}H";}
CLEAR(){ $e "ec";}
CIVIS(){ $e "e[?25l";}
DRAW(){ $e "e%@e(0";}
WRITE(){ $e "e(B";}
MARK(){ $e "e[7m";}
UNMARK(){ $e "e[27m";}
R(){ CLEAR ;stty sane;$e "ece[37;44me[J";};
HEAD(){ DRAW
for each in $(seq 1 13);do
$E " x x"
done
WRITE;MARK;TPUT 1 5
$E "BASH SELECTION MENU ";UNMARK;}
i=0; CLEAR; CIVIS;NULL=/dev/null
FOOT(){ MARK;TPUT 13 5
printf "ENTER - SELECT,NEXT ";UNMARK;}
ARROW(){ read -s -n3 key 2>/dev/null >&2
if [[ $key = $ESC[A ]];then echo up;fi
if [[ $key = $ESC[B ]];then echo dn;fi;}
M0(){ TPUT 4 20; $e "Login info";}
M1(){ TPUT 5 20; $e "Network";}
M2(){ TPUT 6 20; $e "Disk";}
M3(){ TPUT 7 20; $e "Routing";}
M4(){ TPUT 8 20; $e "Time";}
M5(){ TPUT 9 20; $e "ABOUT ";}
M6(){ TPUT 10 20; $e "EXIT ";}
LM=6
MENU(){ for each in $(seq 0 $LM);do M${each};done;}
POS(){ if [[ $cur == up ]];then ((i--));fi
if [[ $cur == dn ]];then ((i++));fi
if [[ $i -lt 0 ]];then i=$LM;fi
if [[ $i -gt $LM ]];then i=0;fi;}
REFRESH(){ after=$((i+1)); before=$((i-1))
if [[ $before -lt 0 ]];then before=$LM;fi
if [[ $after -gt $LM ]];then after=0;fi
if [[ $j -lt $i ]];then UNMARK;M$before;else UNMARK;M$after;fi
if [[ $after -eq 0 ]] || [ $before -eq $LM ];then
UNMARK; M$before; M$after;fi;j=$i;UNMARK;M$before;M$after;}
INIT(){ R;HEAD;FOOT;MENU;}
SC(){ REFRESH;MARK;$S;$b;cur=`ARROW`;}
ES(){ MARK;$e "ENTER = main menu ";$b;read;INIT;};INIT
while [[ "$O" != " " ]]; do case $i in
0) S=M0;SC;if [[ $cur == "" ]];then R;$e "n$(w )n";ES;fi;;
1) S=M1;SC;if [[ $cur == "" ]];then R;$e "n$(ifconfig )n";ES;fi;;
2) S=M2;SC;if [[ $cur == "" ]];then R;$e "n$(df -h )n";ES;fi;;
3) S=M3;SC;if [[ $cur == "" ]];then R;$e "n$(route -n )n";ES;fi;;
4) S=M4;SC;if [[ $cur == "" ]];then R;$e "n$(date )n";ES;fi;;
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
edited Nov 21 '16 at 14:09
techraf
4,36310 gold badges23 silver badges43 bronze badges
4,36310 gold badges23 silver badges43 bronze badges
answered Nov 21 '16 at 13:53
user201523user201523
311 bronze badge
311 bronze badge
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f155417%2fa-set-of-libraries-like-ncurses-in-a-shell-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
There's a
curses
module forzsh
. Here's a quick demo: zsh.org/mla/users/2019/msg00317.html– Kusalananda♦
2 days ago