Skip to content

Instantly share code, notes, and snippets.

@green-coder
Last active October 7, 2016 02:17
Show Gist options
  • Save green-coder/b873537f5dc2834342283f4ecd515240 to your computer and use it in GitHub Desktop.
Save green-coder/b873537f5dc2834342283f4ecd515240 to your computer and use it in GitHub Desktop.
This prepends a header file to each matching file, recursively on the file system.
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
IFS=$'\n'
for f in $(find . -name '*.cs')
do
if ! grep -q Copyright "$f"
then
cat "$DIR"/copyright_header.txt "$f" >"$f".new && mv "$f".new "$f"
fi
echo "$f"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment