Skip to content

Instantly share code, notes, and snippets.

@remkus
Created December 5, 2023 13:24
Show Gist options
  • Save remkus/a20049c98aeec1f761139dea445b01ca to your computer and use it in GitHub Desktop.
Save remkus/a20049c98aeec1f761139dea445b01ca to your computer and use it in GitHub Desktop.
Run WP CLI commands in Bulk
#!/bin/bash
# @link https://remkusdevries.com/wp-cli/run-wp-cli-scripts-in-bulk-across-various-servers
# List of iTerm2 profile names
profiles=(
"Example 1"
"Example 2"
"Example 3"
# ...add all profiles here
)
# WP-CLI command to run
wp_command="wp core version" # Replace with your command
# Loop through each profile and open a new tab in iTerm2
for profile in "${profiles[@]}"; do
osascript <<EOF
tell application "iTerm"
tell current window
create tab with profile "$profile"
end tell
tell current session of current window
write text "cd public" # Replace with your path
write text "$wp_command"
end tell
end tell
EOF
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment