Contribution: Checking for single Key press with Busybox ash

Harald Becker ralda at gmx.de
Sun Jul 14 02:53:46 UTC 2013


A more complex example of how you can use this single press key
feature: A configureable menu system,  just using Busybox
standard tools.

- main.mnu (or any name you select) contains the menu
  make it executable with chmod u+x main.mnu

- run your menu like a normal command (./main.mnu)

- the #! marks it as a script and names menu.sh as it's
  interpreter (via /bin/sh)

- menu.sh itself is a shell script and defines the functions and
  aliases used in the menu file. Add further menu commands and
  aliases to this file as you like or define the look and feel of
  your menu system there.

- All the key tokens you want to use are defined in menu_keys.tbl

- Enter your menu text in your .mnu file and define the commands
  to execute when your selected key is pressed.

  May just exec any other menu file you like or use the command
  menu="menufile.mnu" to switch to any other menu file you like.


This is the very base of a menu system just using simple standard
tools. The first version of this I put together on a small
Busybox based router box, which doesn't allow to add other
compiled programs, but runs fine with this bunch of shell scripts.

May be anyone like to use this.

But one big attention: As soon as you start this menu system you
are not able to abort the script execution with Ctrl-C, etc. So
have another terminal to access device and kill first process or
be prepared to reset your device ... and don't kill me, if you
add this untested in your autostart!

--
Harald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.mnu
Type: application/octet-stream
Size: 742 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20130714/3d4ced40/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: menu.sh
Type: application/x-shellscript
Size: 857 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20130714/3d4ced40/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: menu_keys.tbl
Type: application/octet-stream
Size: 158 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20130714/3d4ced40/attachment-0001.obj>


More information about the busybox mailing list