| 1 | #!/bin/bash |
| 2 | # viewdata.sh |
| 3 | # Conversion of VIEWDATA.BAT to shell script. |
| 4 | |
| 5 | DATAFILE=/home/bozo/datafiles/book-collection.data |
| 6 | ARGNO=1 |
| 7 | |
| 8 | # @ECHO OFF Command unnecessary here. |
| 9 | |
| 10 | if [ $# -lt "$ARGNO" ] # IF !%1==! GOTO VIEWDATA |
| 11 | then |
| 12 | less $DATAFILE # TYPE C:\MYDIR\BOOKLIST.TXT | MORE |
| 13 | else |
| 14 | grep "$1" $DATAFILE # FIND "%1" C:\MYDIR\BOOKLIST.TXT |
| 15 | fi |
| 16 | |
| 17 | exit 0 # :EXIT0 |
| 18 | |
| 19 | # GOTOs, labels, smoke-and-mirrors, and flimflam unnecessary. |
| 20 | # The converted script is short, sweet, and clean, |
| 21 | #+ which is more than can be said for the original. |