LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   open list of files with xdg-open (http://www.linuxquestions.org/questions/programming-9/open-list-of-files-with-xdg-open-4175448388/)

mahkoe 02-02-2013 05:24 PM

open list of files with xdg-open
 
I have a fancy sed command in a bash script that, depending on command parameters, returns a list of files separated by a newline. I would like to use xdg-open to open all the files, but xdg-open can apparently only take one file at a time. I am pretty new at bash scripting, so I was wondering if anyone has a way getting around this problem and opening all the files with xdg-open

Thanks!

Snark1994 02-03-2013 12:48 PM

Sure:

Code:

fancy_sed_command | while read line; do
    xdg-open $line
done

or

Code:

fancy_sed_command | while read line; do
    xdg-open $line &
done

if you want them all opened at the same time, not one by one

Regards,


All times are GMT -5. The time now is 12:24 AM.