Search code examples
shellfindzenity

Zenity list find results


I am trying to make a list of all find results but it gets all results as one option. How to make every result different option to choose and store it in CHOICE?

CHOICE=$(zenity --list --title "Choose file:" --column=Files "$(find $DIRECTORY -name "*.cpp")")

Solution

  • Too many quotes:

    zenity --list --title "Choose file:" --column=Files $(find $DIRECTORY -name "*.h")
    

    The double quotes around "$(find)" make the result a single very long filename, when instead you want to use word-splitting to make them separate files. Note that you will have problems with filenames containing white-space.