Skip to content

Instantly share code, notes, and snippets.

@singchia
Forked from magnific0/add_license_to_missing.sh
Created January 28, 2022 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save singchia/a734407bcd00c38de6f68db0f3849d2b to your computer and use it in GitHub Desktop.
Save singchia/a734407bcd00c38de6f68db0f3849d2b to your computer and use it in GitHub Desktop.
Add a copyright license header to all CPP and H files
#!/bin/bash
read -r -d '' license <<-"EOF"
/* Copyright (c) 2010-2017, Delft University of Technology
* All rights reserved
*
* This file is part of the Tudat. Redistribution and use in source and
* binary forms, with or without modification, are permitted exclusively
* under the terms of the Modified BSD license. You should have received
* a copy of the license with this file. If not, please or visit:
* http://tudat.tudelft.nl/LICENSE.
*/
EOF
files=$(grep -rL "Copyright (c) 2010-2017, Delft University of Technology" * | grep "\.h\|\.cpp")
for f in $files
do
echo -e "$license" > temp
cat $f >> temp
mv temp $f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment