22

I went through a command called 'pick' in some Unix book, but didn't understand what it does exactly. Below is a sample pick command:

pick abc.*
Mat
  • 52,586

1 Answers1

29

pick command is the one where for each given argument, it asks yes/no and prints the selection to stdout. It accepts a list of choices as input and produces the selected choice as output. Example to use pick:

find -type f | pick | xargs xdg-open

This allow you to select a file in the list found by the find command using an ncurses(3X) interface and open it with xdg-open

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Dababi
  • 3,355
  • 24
  • 23
  • Is it supported in bash shells, because I tried using it in an online bash terminal , and it gave "command not found" error. – Pankaj Pandey Dec 27 '16 at 09:31
  • yes it is supported but you must install it apt-get install pick (debian) – Dababi Dec 27 '16 at 09:33
  • Can u explain the command with a simpler query as I am not familiar with xargs command? – Pankaj Pandey Dec 27 '16 at 09:35
  • 2
    xargs will take the text chosen by the pick command and make an argument to xdg-open from it. another example is find -name *.txt | pick | xargs gedit. This will allow you to pick a txt file from the list found by the find command and open it with gedit (xargs will pass it as an argument to gedit) – Dababi Dec 27 '16 at 09:41
  • so in the above example the 'pick' command will give a prompt for printing the file names on the terminal.. is that correct? – Pankaj Pandey Dec 27 '16 at 10:24
  • find will search and show a list of .txt filesfrom your filesystem. pick will allow you to choose one of them in an interactive interface – Dababi Dec 27 '16 at 10:29
  • thnks.. @Dababi – Pankaj Pandey Dec 27 '16 at 10:33