Skip to content

A minimal POSIX shell menu in 50 lines that only use stty, dd and od

License

Notifications You must be signed in to change notification settings

j8r/SimpleShellMenu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Shell Menu - A minimal POSIX shell menu

screenshot

Use

ssm "Title
Description" "antoher descriptions(can be empty)
Choice 1
Choice 2
Choice 3" "tab/space for choices"

case "$ssm_text" in
  "Choice 1") printf "First choice selected\n";;
  "Choice 2") printf "Second choice selected\n";;
  "Choice 3") printf "Third choice selected\n";;
  "Choice 4") printf "Fourth choice selected\n";;
esac

case $ssm_line in
  1) printf "First choice chosen\n";;
  2) printf "Second choice chosen\n";;
  3) printf "Third choice chosen\n";;
  4) printf "Fourth choice chosen\n";;
esac

Example

. ./ssm.sh

ssm "\33[0;33m  Select an app with arrows <-v->\33[0m
  \33[0;33mConfirm with Enter <-'\33[0m" "\33[1;31m         Exit with Esc/Q\33[0m
Choice 1
Choice 2
Choice 3
Choice 4" "    "

case "$ssm_text" in
  "Choice 1") printf "First choice selected\n";;
  "Choice 2") printf "Second choice selected\n";;
  "Choice 3") printf "Third choice selected\n";;
  "Choice 4") printf "Fourth choice selected\n";;
esac

case $ssm_line in
  1) printf "First choice chosen\n";;
  2) printf "Second choice chosen\n";;
  3) printf "Third choice chosen\n";;
  4) printf "Fourth choice chosen\n";;
esac

For colors code, you can refer to shellcolors.sh

License

SimpleShellMenu- A minimal POSIX shell menu

Copyright (c) 2016 Julien Reichardt - MIT License (MIT)

About

A minimal POSIX shell menu in 50 lines that only use stty, dd and od

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages