Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Bash: While read with 2 args?

Options
  • 07-06-2019 3:48pm
    #1
    Registered Users Posts: 5,576 ✭✭✭


    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 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