Tip of the day: Mac Shell Scripting
The solution can be to use a desktop project in Real Studio. When you launch it on your Mac from your shell script, you need to launch the app directly. Not using open command or some other launch facility. So path could be /somefolder/MyApp.app/Contents/MacOS/MyApp. As you see it points inside the bundle to the executable inside.
When you launch your app that way from the terminal, you can use StdOutMBS class to write text to the terminal.