Created
August 25, 2019 12:38
-
-
Save simonrenger/5a945e3aef06619ed9282f302077c93d to your computer and use it in GitHub Desktop.
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 | |
echo "License Append script" | |
license=$1 | |
ending=$2 | |
folder=* | |
file="" | |
scan_for_folders(){ | |
for i in $folder; do | |
if [ -d $i ] | |
then | |
folder=$i/* | |
scan_for_folders | |
else | |
file=$i | |
edit_file | |
fi | |
done | |
} | |
edit_file(){ | |
local content="" | |
if [ -f $file ] | |
then | |
if [[ $file == $ending ]] | |
then | |
cat $license $file > $file".new" | |
mv $file".new" $file | |
fi | |
fi | |
} | |
scan_for_folders |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment