Skip to content

Instantly share code, notes, and snippets.

@yitznewton
Forked from dazz/addlicense.sh
Created February 4, 2014 13:50
Show Gist options
  • Save yitznewton/8803879 to your computer and use it in GitHub Desktop.
Save yitznewton/8803879 to your computer and use it in GitHub Desktop.
#!/bin/bash
find . -name '*.php' -type f | while read files
do
sedtest=$(sed -n '/^/,/$/p' "${files}" | sed -n '/<?php/p')
if [ "${sedtest}" ]
then
echo ${files}
sed -e "s@<?php@<?php\n\/\*\*\n \* EasyBib Copyright 2008-2014\n \* Modifying, copying, of code contained herein that is not specifically authorized\n \* by Imagine Easy Solutions LLC ("Company") is strictly prohibited. Violators will\n \* be prosecuted.\n \*\n \* This restriction applies to proprietary code developed by EasyBib. Code from\n \* third-parties or open source projects may be subject to other licensing\n \* restrictions by their respective owners.\n \*\n \* Additional terms can be found at http://www.easybib.com/company/terms\n \*\/@g" "${files}" > "${files}".tmp
mv "${files}".tmp "${files}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment