Let the user choose between multiple items and save the selected one to a file

dmenu

  • Dynamic menu.
    Creates a menu from a text input with each item on a new line.
    More information: <https://manned.org/dmenu>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

echo -e "{{red}}\n{{green}}\n{{blue}}" | dmenu > {{color.txt}}

click the source code to copy install dmenu on any operating system with command-not-found.com