Fix bash stuff: functions and shebang.