set shell to (finalShellArguments's stringByReplacingOccurrencesOfString:"~" withString:(POSIX path of (path to home folder)) options:NSCaseInsensitiveSearch range:{0, finalShellArguments's |length|()}) as text