1

Is there a compact way to store the output of a find command into a list ?

Something like:

find / -name "mov*.txt" | read var

But in a list in order to store all the paths found.

  • 4
    `set results (find ...)` will do it -- fish command substitutions splits the results on newlines. – glenn jackman Jan 02 '19 at 19:54
  • 1
    `bash` and `fish` are two different shells. Please untag the one you're not interested in – that other guy Jan 02 '19 at 20:00
  • For Bash see [Capturing output of find . -print0 into a bash array](https://stackoverflow.com/q/1116992/4154375). – pjh Jan 02 '19 at 20:06
  • It's not clear why you are reading into var. The find command dumps all the paths, so save that to a text file and you have your list of paths. Perhaps you could edit this to show values of what your list looks like to you? Rather than describe how you think to solve it - give the sample data and the sample results. There's a great explainer called [mcve] on how to edit this into a post. – bmike Jan 12 '19 at 15:33

0 Answers0