AppleScript prints out keypresses, doesn't execute them I expect this script to switch applications (command tab):

$ cat hello.applescript
tell application "System Events"
 key code 48 using command down
end tell


But it just prints out a tab:

$ osascript hello.applescript
⏎   


I'm on OS X 10.9.4
I've not used it inside a shellscript, only in 'pure' Applescript, but why not just 

tell application "myApp" to activate


..it would prevent the randomness of which particular app was next in line.