Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Bash: While read with 2 args?

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


    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