4 ms·
I recently stumbled across tmux while trying to provide a more customized UX in a bash script. Tmux and screen seemed a little more powerful than I needed, with
by deckar01 11y ago
I recently stumbled across tmux while trying to provide a more customized UX in a bash script. Tmux and screen seemed a little more powerful than I needed, with lots of ways to accidentally corrupt the terminal. More and less were pretty close to what I wanted, but I could not figure out how to accept arbitrary input from the less prompt, exit, and pass it to bash.
Maybe that's not what less is for. Any tips on how I can create a less UX with custom input handling would be appreciated.
- zehemer 11y agoThe select builtin might help in your case: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_09_06.html http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_09_06.htm...
- pmoriarty 11y agoCheck out rlwrap.[1] [1] - http://utopia.knoware.nl/~hlub/uck/rlwrap/ http://utopia.knoware.nl/~hlub/uck/rlwrap/
- deckar01 11y agoFor future reference, if you want to replicate a git-like man page UX (using less as the pager) the trick is defining custom commands with lesskey[0]. You can specify the exit status of the "quit" action to pass the information back to the calling script. [0] https://www.freebsd.org/cgi/man.cgi?query=lesskey&sektion=1 https://www.freebsd.org/cgi/man.cgi?query=lesskey&sektion=1