Skip to content

Instantly share code, notes, and snippets.

@michael-sumner
Last active March 4, 2024 09:02
Show Gist options
  • Save michael-sumner/b96f855cf6b7a8f601829a4516c6dd48 to your computer and use it in GitHub Desktop.
Save michael-sumner/b96f855cf6b7a8f601829a4516c6dd48 to your computer and use it in GitHub Desktop.
Pantheon terminus - How to Loop in Subshell Commands
# Example: loop through all post ids and update the post meta for each post_id to assign the post_date
for post_id in $(terminus remote:wp examplesite.environment -- post list --format=ids); do terminus remote:wp examplesite.environment -- post meta update "$post_id" examplemeta_start_date "$(terminus remote:wp examplesite.environment -- post get $post_id --field=post_date)"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment