convert osascript to bash for testability