mk_gitignore.sh (1352B)
1 #!/bin/bash 2 # generate variables.txt 3 # Author: Andreas HABEGGER <andreas.habegger> 4 # Date : 2017 5 # Based on an idea by Albert Reiner. 6 7 _FILE_PERM=644 8 9 OUTFILE=".gitignore" # Name of the file to generate. 10 11 OUTFILE="${_DESTINATION_DIR}/${OUTFILE}" 12 13 # ----------------------------------------------------------- 14 # 'Here document containing the body of the generated script. 15 ( 16 cat <<'EOF' 17 # Ignore Linux temp files 18 *~ 19 20 # Ignore Mac specific files 21 .DS_Store 22 23 # Ignore Windows temp files 24 *.log 25 *.temp 26 *.tmp 27 28 # Ignore NFS lock ressources 29 .nfs* 30 31 # Ignore Snapshots directories 32 .snapshot 33 34 #ignore all autobuild directories 35 _* 36 37 # ignore Emacs temp buffers 38 \#* 39 \.#* 40 41 # ignore TAR archives 42 *.tar 43 44 # exclude vc version-check scripts 45 vc.tex 46 temp/ 47 *.log 48 49 # do not track merge or other orig cpy files 50 *.orig 51 52 # exclude files other than *.c from exsrc 53 exsrc/* 54 !exsrc/*.c 55 !exsrc/*.h 56 !exsrc/*.cpp 57 !exsrc/*.hpp 58 !exsrc/*.hh 59 !exsrc/*.cc 60 61 # Ignore all sample files 62 sample-* 63 sample_lecture* 64 65 EOF 66 ) > $OUTFILE 67 # ----------------------------------------------------------- 68 69 # Quoting the 'limit string' prevents variable expansion 70 # within the body of the above 'here document.' 71 # This permits outputting literal strings in the output file. 72 73 if [ -f "$OUTFILE" ] 74 then 75 chmod ${_FILE_PERM} ${OUTFILE} 76 else 77 echo "Problem in creating file: \"$OUTFILE\"" 78 fi 79 80 81 exit 0