Skip to content

Instantly share code, notes, and snippets.

@amitrahav
Created March 30, 2017 01:43
Show Gist options
  • Save amitrahav/338daeb1207c66e3d541b176367a8e8d to your computer and use it in GitHub Desktop.
Save amitrahav/338daeb1207c66e3d541b176367a8e8d to your computer and use it in GitHub Desktop.
creating plugins.json file using bash script
#! /bin/bash
wpCLI=`wp`
if [ "$wpCLI" = "" ]
then
echo "WP-cli does not exist on this system."
# exit 1
fi
wp plugin list | tr -d '|' | grep 'active' | cut -f 1,4 | awk ' BEGIN { ORS = ""; print "plugins: {"; } { print "\/\@"$1"\/\@" " : " "\/\@"$2"\/\@"; } END { print "},"; }' | sed "s^\"^\\\\\"^g;s^\/\@\/\@^\",\"^g;s^\/\@^\"^g" > pluginss.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment