First, when I open that text file, emacs tells me that it's using DOS line endings. You need to run dos2unix
on the script to change the DOS line endings to Unix line endings. The DOS line endings can cause some pretty odd problems.
I would not use the more
command. The more command is an interactive pager. It waits for user input--even if the file being displayed is a single line. You probably should use:
Third, you are mixing and matching numeric equality tests with string values. For instance:
if [ "$blah" -eq "1" ]
if [ "$blah" -eq "2" ]
The -eq, -lt, -gt, and similar comparison operators are for comparing numeric values--not strings. To test that two strings match, you should use =, !=, etc. For example:
if [ "$blah" = "1" ]
if [ "$blah" = "2" ]
There may be more problems, but those are what I saw off-hand.