Install automator service via command line I would like to automate my Mac installation flow for services. The following is my script:

#!/bin/sh
rm -rf ./tempWorkflows
mkdir tempWorkflows
for filename in ./*.workflow; do
    cp -R "$filename" ./tempWorkflows/"$filename"
done
for filename in ./tempWorkflows/*.workflow; do
    open $filename
done
rm -rf ./tempWorkflows


It basically copy all my *.workflow and open it. However, for open $filename, it prompts and asking for a confirmation:



Is there a way to add --no-prompt or similar flag for the open command?

EDIT:

I am using El Capitan 10.11.3
If Automator is closed then open Automator and select Application under Choose a type for your document, then click the Choose button. If it's already open the choose File > New and select Application under Choose a type for your document.

Add a Run Shell Script Action to it.

Copy and paste the shell code you presently have into the Run Shell Script Action.

Add the following lines of code after: open $filename

sleep 1
osascript -e 'tell application "System Events" to click button "Install" of window "Service Installer" of process "Automator"'
sleep 1
osascript -e 'tell application "System Events" to click button "Done" of window "Service Installer" of process "Automator"'


Note: You should also add an appropriate cd line above the rm -rf ./tempWorkflows line you presently have in your code, e.g. cd /some/directory/path where it's the pathname of the location your .workflow files are located for processing by your script. 

Save the Automator Application as Install Automator Service.

Next:

Open System Preferences > Security &amp; Privacy > Accessibility > Privacy

Click the Lock icon to make changes and type in your password, then click the Unlock button.

User the [+] to add the Install Automator Service or drag and drop the application bundle into the window.

This will now allow the Install Automator Service application to run your shell code and use the AppleScript code to click the Install button and subsequent Done button on the Service Installer dialog box in the process of installing your Services.