Initial changes to reflect attempts to POSIXify this bot.
Half way through correcting iibot with checkbashisms