Skip to content

Instantly share code, notes, and snippets.

@petertoi
Created March 13, 2015 15:43
Show Gist options
  • Save petertoi/79d77b041f1f8f93c456 to your computer and use it in GitHub Desktop.
Save petertoi/79d77b041f1f8f93c456 to your computer and use it in GitHub Desktop.
Performs a recursive scan from the current directory for the specified file and outputs matched files and plugin version
#!/bin/sh
#
# Author: Peter Toi
# Source: https://gist.github.com/petertoi/79d77b041f1f8f93c456
#
# Usage 1: $ check_plugin_version.sh # No argument will prompt for plugin file name
# Usage 2: $ check_plugin_version.sh pluginfile # Skip the prompts by including the file name as an argument
if [ "$#" -eq 1 ]
then
pluginfile=$1
else
echo "Main plugin PHP file name (Ex: wp-seo.php): "
read pluginfile
fi
for filename in $(find ./ -type f -name $pluginfile)
do
echo "$filename:$(head -n 20 $filename | grep "Version")"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment