RosettaCodeData/Task/Scope-Function-names-and-labels/UNIX-Shell/scope-function-names-and-labels.sh
2023-07-01 13:44:08 -04:00

10 lines
304 B
Bash

#!/bin/sh
multiply 3 4 # This will not work
echo $? # A bogus value was returned because multiply definition has not yet been run.
multiply() {
return `expr $1 \* $2` # The backslash is required to suppress interpolation
}
multiply 3 4 # Ok. It works now.
echo $? # This gives 12