Suppose I'm a lazy bum and want to avoid putting every string in quotes when passing arguments to a function, how do I avoid the characters *
and ?
being used by bash for patname expansion?
Simplified example:
fn () {
echo "$1"
}
# shopt -s option - disable * and ?
fn not/*/expanded
fn neither\ should\ this/be/expanded?
fn 'accepted too*'
# shopt -u option - enable * and ?
This should output:
not/*/expanded
neither should this/be/expanded?
accepted too*