My find looks really simple:
find . -type f
I'm trying to figure out how to exclude certain files or directories, depending on the program argument line.
bash myscript.sh -excl a b c d
Where a, b, c, d or any next argument of excl option is a regex referring to certain files or directories I want to exclude.
So if I called the program this way:
bash myscript.sh -excl *.sh somedir
I simply want find to ignore somedir directory and all files with .sh extension. Is this possible in bash?
*.shlooks more like a globbing pattern with*being the wildcard character rather than regex.-excl a b c dis not a posix style. Either--exclude a,b,c,dor-e a,b,c,dor-e a -e b -e c -e dor you're confusing most of script's users. Secondly, it's not a bash problem at all.findis not a part ofbashfind /path/to/dir -not -name "*.sh" -not -name somedir(untested)