Search code examples
bashmenudialog

dialog menu to disply files and select one of them


Please advise me on how I can do the following with the dialog utility:

I want to display all the files under /home directory in menu, and select only one of them. Then the script will print the full path of the selected file.

I have created the following script:

this script only displays the files in the dialog box menu

    #!/bin/bash

    dialog --title "List file of directory /home" --msgbox "$(ls /home )" 100 100

Solution

  • Code & copy/paste not really available on the stack exchange android app.

    CHOICE='dialog --title "List " --radiolist "$(ls /home)" 100 100'

    echo "/home/$CHOICE"

    Note: i have used ' for back-tick my keyboard has no back-tick.