Bash – Fluxbox menu entry that prompts for some input

bashdialogfluxboxx11

How do I ask 'which man file would you like to open?' in one command from the commandline, which will also open xterm at the same time. This is needed for a fluxbox menu item.

For it to be a fluxbox menu item, it must fulfil this format

[exec] (Which man page do you want to read?) {read -p 'which man file would you like to open? '; xterm -e man "$REPLY"}

where

  • [exec] – look out its an executable command
  • (Question) – title
  • {xterm -e man tmux} – command with this syntax

Best Answer

This will prompt for a manpage and open it in xterm:

read -p 'which man file would you like to open? '
xterm -e man "$REPLY"

This will run the prompt in a new instance of xterm:

xterm -e sh -c 'read -p "which man file would you like to open? " && man "$REPLY"'
Related Question