{"id":1518,"date":"2017-10-30T09:00:57","date_gmt":"2017-10-30T00:00:57","guid":{"rendered":"https:\/\/n8finch2024.local\/?p=1518"},"modified":"2017-10-30T09:09:37","modified_gmt":"2017-10-30T00:09:37","slug":"wrote-first-bash-script-implement-wp-cli-managed-sites","status":"publish","type":"post","link":"https:\/\/n8finch2024.local\/wrote-first-bash-script-implement-wp-cli-managed-sites\/","title":{"rendered":"How I Wrote My First Bash Script to Implement WP-CLI on Managed Sites"},"content":{"rendered":"
They say if you want to learn something, teach.<\/p>\n
Or scratch your own itch.<\/p>\n
Or just do it.<\/p>\n
In any case, I had an itch that I have been wanting to find a fix for for a while.<\/p>\n
If you are a developer like me, you began figuring this “WordPress thing” out through tutorials, trial and (mostly) error, and trying a lot of different things out.<\/p>\n
Also, if you’re like me, you got into this for several reasons, one of which is the joy of helping people out and getting them a website setup and launched. I love the satisfaction of getting that project launched and the joy these folks have when they realize they can manage their own publishing.<\/p>\n
And of course, if you’re a developer like me, you have a shared hosting account with at least a dozen different websites that are small personal projects or folks on the “friends and family plan” (read “free hosting” \ud83d\ude42 ). This means I have a dozen or so sites I want to make sure I keep updated, but don’t want to spend a lot of time updating.<\/p>\n
So, I decided to learn enough bash to write a script that would execute WP-CLI commands on my local environment as well as my shared hosting.<\/p>\n
Here’s how I did it…<\/p>\n
<\/p>\n
Here’s the .sh<\/code>\u00a0file that I am currently using to update all my sites from the command line.<\/p>\n