How to open applications in fullscreen via Terminal I just created a script to open my most-used apps, but I have two questions about it.

The code of the script is the following:

#!/bin/bash
echo "Hi $(whoami)"
echo "Openning your default apps..."
open -a Mail
open -a Wunderlist
open -a Reminders
open -a Notes
open -a Pocket
open -a Safari
echo "Do you want social networks? [y|n]"
read social
if [[ $social == "y" ]]; then
    open -a Telegram
    open -a Safari http://web.whatsapp.com
    open -a TweetDeck
fi
echo "Do you want to listen some music? [y|n]"
read music
if [[ $music == "y" ]]; then
    open -a iTunes
fi
echo "Have a nice day $(whoami)! :D"


So here come the questions:


How can I open those apps in fullscreen by default? iTunes have memory and open in fullscreen mode, but the others don't.
How can I keep Terminal in foreground while the other apps are being open?
How can I keep Terminal in foreground while the other apps are being open?


Use the -g or --background flag to open:


 -g  Do not bring the application to the foreground.



for example:

open -g -a Notes

will open Notes.app in the background.

Unfortunately not all apps appear to respect this. For those apps you may need to hide them manually using AppleScript:

osascript -e 'tell application "System Events" to set visible of process "FOO" to false'

where FOO is the name of the app.

p.s. - instead of $(whoami) you can use $LOGNAME