Created
March 30, 2017 01:43
-
-
Save amitrahav/338daeb1207c66e3d541b176367a8e8d to your computer and use it in GitHub Desktop.
creating plugins.json file using bash script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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