| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # Reading lines in /etc/fstab. |
| 3 | |
| 4 | File=/etc/fstabscip-shell filesystem . . `/etc/fstab`. |
| 5 | |
| 6 | { |
| 7 | read line1 |
| 8 | read line2 |
| 9 | } < $File |
| 10 | |
| 11 | echoscip-shell system . . echo. "First line in $File is:" |
| 12 | echoscip-shell system . . echo. "$line1" |
| 13 | echoscip-shell system . . echo. |
| 14 | echoscip-shell system . . echo. "Second line in $File is:" |
| 15 | echoscip-shell system . . 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. |