| 1 | #!/bin/bash |
| 2 | # Reading lines in /etc/fstab. |
| 3 | |
| 4 | File=/etc/fstab |
| 5 | |
| 6 | { |
| 7 | read line1 |
| 8 | read line2 |
| 9 | } < $File |
| 10 | |
| 11 | echo "First line in $File is:" |
| 12 | echo "$line1" |
| 13 | echo |
| 14 | echo "Second line in $File is:" |
| 15 | echo "$line2" |
| 16 | |
| 17 | exit 0 |
| 18 | |
| 19 | # Now, how do you parse the separate fields of each line? |
| 20 | # Hint: use awk, or . . . |
| 21 | # . . . Hans-Joerg Diers suggests using the "set" Bash builtin. |