Unlike in most other languages, parenthesis are not allowed in function calls in BASH:
#!/bin/bash function test() { echo "sudo scanimage --warmup-time 2 --format pnm --depth 8 --resolution $resolution -l $l -t $t -y $y -x $x > $1.pnm"; } test "bar";
Is working, while
test("bar");
does not work.