Running Shell Script
- 
					
					
					
					
 I am seeing strange behavior when running a shell script. I am using foreground. When I run the command from the GUI editor, it doesn't immediately run. If I close the editor and re-open it, the command runs immediately upon reopening the editor. If I try to run the command from Alexa, it doesn't run at all. I have another command that uses pmset and that one runs fine. Any ideas what's happening? 
- 
					
					
					
					
 @abaratz, that is strange. Can you share the script? It might give me a clue. 
- 
					
					
					
					
 @Russ Here you go. Thank you. #!/bin/bash 
 if [ "$1" == "open" ]
 then
 open -a "Slack"
 open -a "Microsoft Outlook"
 open -a "Safari"
 else
 shortcuts run "Quit All Applications"
 pmset sleepnow
 fi
- 
					
					
					
					
 @Russ Actually, I just removed the call to shortcuts and it ran fine. Should I be doing something differently with respect to running a shortcut in the script? Thank you. 
- 
					
					
					
					
 @Russ Nevermind :). I just saw another post on running shortcuts. I wrapped the shortcuts call in my shell script inside of a call to AppleScript for running the shortcut and that worked. Sorry to bother you. 
- 
					
					
					
					
 @abaratz, no problem. I'm glad you got it working. Would you mind sharing your final working script? 
- 
					
					
					
					
 @Russ Sure. Here is the shell script: #!/bin/bash 
 if [ "$1" == "start" ]
 then
 open -a "Slack"
 open -a "Microsoft Outlook"
 open -a "Safari"
 else
 osascript ~/Smarthome/Closeallapps.scpt
 pmset sleepnow
 fiAnd here is the AppleScript for Closeallapps: tell application "Shortcuts Events" 
 set theResult to run shortcut "Quit All Applications"
 end tell
