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?

  • 1
    Are you certain the echo isn't being run? And that the Terminal window that Alfred pops up just isn't being destroyed before you can see the echo? Try adding a sleep 60m to the end of the script after the echo command to keep transient windows alive on the screen.
    – Ian C.
    Mar 1 '12 at 14:27
  • You're right Ian! Alfred basically has this Growl enable checkbox, which I didn't enable, so the output wasn't getting captured anywhere Mar 1 '12 at 14:42

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .