📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    Which command will read input line-by-line from a file

    in a shell script?
    A while read line; do ... done < filename Correct Answer Incorrect Answer
    B cat filename | while read line Correct Answer Incorrect Answer
    C Both A and B Correct Answer Incorrect Answer
    D readline filename Correct Answer Incorrect Answer
    E read < filename Correct Answer Incorrect Answer

    Solution

    Both syntax styles use the read command inside a loop to process each line of a file sequentially.

    Practice Next
    ask-question