Make auto-reencode work on Linux and OSX

Some changes to make auto-reencode work on Linux and OSX. Might need some more work to work across different shells.