As you're getting errors even before the first echo statement, I'd guess that you've saved the file in DOS format, not in UNIX format. You should be able to convert it using either sed/tr (either of the following two lines - the ^M is generated by pressing Ctrl-V followed by Ctrl-M): Code: tr -d '\r' < DOS_file > UNIX_file sed 's/^M//' DOS_file > UNIX_file
tr -d '\r' < DOS_file > UNIX_file sed 's/^M//' DOS_file > UNIX_file