Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Bash: While read with 2 args?

  • 07-06-2019 03:48PM
    #1
    Registered Users, Registered Users 2 Posts: 5,762 ✭✭✭


    Done bash while loops for years but im used to seeing the following to read a file line by line
    while read line
      #code
    done < file
    

    But have come across this
    while read section file_path; do
        # code...
     done < file
    

    What is this doing?


Comments

  • Registered Users, Registered Users 2 Posts: 7,157 ✭✭✭srsly78


    section will be the first token from the line, file_path will be the rest

    input is probably something like

    A /mnt/cheezburger
    B /mnt/whatever
    C /mnt/lalalal


Advertisement