Skip to content

Instantly share code, notes, and snippets.

@cnbeining
Last active July 26, 2016 22:02
Show Gist options
  • Save cnbeining/3a76ff36223b181f78c609f1360837cd to your computer and use it in GitHub Desktop.
Save cnbeining/3a76ff36223b181f78c609f1360837cd to your computer and use it in GitHub Desktop.
addhonourcode.sh: Add honour code for UofT CSCB07 projects on every source file.
#!/bin/sh
: '
addhonourcode.sh: Add honour code for UofT CSCB07 projects on every source file.
License: GPL v3 or later.
Usage: addhonourcode.sh NAME_OF_THE_PROJECT UTORID Student# Your_Name_Quoted
Put under the SOURCE CODE FOLDER, and make sure there does not
exist any other file that you do not want the code being added
under all the folder and sub-folders.
Author: One who prefer remain anonymous
'
if [ "$#" -ne 4 ]; then
echo "Usage: "$0" NAME_OF_THE_PROJECT UTORID Student# Your_Name_Quoted"
exit 1
fi
read -r -d '' CODEFORMATTED << EOM
// **********************************************************
// $1:
// UTORID user_name:$2
// UT Student #:$3
// Author:$4
//
//
// Honor Code: I pledge that this program represents my own
// program code and that I have coded on my own. I received
// help from no one in designing and debugging my program.
// I have also read the plagiarism section in the course info
// sheet of CSC B07 and understand the consequences.
// *********************************************************
EOM
FILELIST=`find . -type f`
for file in $FILELIST; do
if [[ ${file} != *"$0"* ]];then
echo "$CODEFORMATTED" > tmpfile
cat $file >> tmpfile
mv tmpfile $file
rm tmpfile 2> /dev/null
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment