opening an app in a shell script with sudo
Just try sudo appthatneedsport25, no need to use open when dealing with bash or shell scripts. If it is an interpreted script (python ruby etc) and it isnt set to executable, you can always do sudo python scriptname.