Screencapture Terminal command and then return to Shell script

bashscreen captureterminal

I'm trying to run a shell script wherein I run the screencapture command, do a couple of modifications like file renaming, moving to Dropbox, shortening the url etc and then growling the url.

Problem is, after running the "screencapture" terminal command, following commands aren't executed like so:

screencapture -i ~/Dropbox/Public/ScreenShot_TestScreenShot1.png
# below doesn't get executed
echo "your file is at ~/Dropbox/Public/ScreenShot_TestScreenShot1.png"

(For the curious: The shell script is triggered from from Alfred)

Anyway of returning to the shell script after running the screencapture command?

Best Answer

The problem isn't that control is not being returned to your script, it's that the output from the echo command isn't being captured and reported to you. It could be that Alfred is closing the transient Terminal.app window that it's using to run the script. To test that add a sleep 60m to the end of the script which should keep the window on the screen.

Or it could be that all stdout/stderr from the script is going to /dev/null or something similar. Make sure Alfred isn't throwing away the output. Based on our comment conversation it sounds like that's what Alfred does with std I/O.