#!/bin/bash ignore=( "*.txt" "test/*" "*#" #ods-tmp-files *skyglow.log __pycache__ ) projdir=`dirname "$(realpath $0)"` ignorefile="${projdir}/.gitignore" cd "${projdir}" #ignore .txt files in find, since they are ignored anyway find . -size +50M ! -name '*.txt' | sed 's/\.\///g' > "${ignorefile}" for i in "${ignore[@]}" do echo "$i" >> "${ignorefile}" done #cd -