Heya!
I'm writing a bash script that among other things has a function that will stop the script if an argument is included in a string, but will continue to run if an exclusion is available in another string. Like this:
Code:
denydirs="foo*|bar*"
exclusions="foo-bar|bar-foo"
some_function() {
if [[ ! ${2} =~ .*(${exclusions}).* && ${2} =~ .*(${denydirs}).* ]]; then
exit 1
else
other_function "$2"
fi
}
and the function is called from another function further down the script by:
Code:
some_function "$2"
Now, this is weird, but the function above used to work just fine, but all of a sudden for some reason it has stopped working and I can't figure out what I'm doing wrong so I thought i should ask the expertise here about it

.
Here's another example of something that stopped working but was working before:
Code:
yet_another_function() {
if [[ "${#}" != 2 ]] || [[ ${debug_mode} == 0 && "${#}" != 3 ]]; then
...
}
This i could easily rewrite to get it working again, but I'm stuck at the first example
So what is it that I'm doing wrong here?