shell script function with parameters code example
Example 1: bash function arguments
#!/usr/bin/env sh
foo 1 # this will fail because foo has not been declared yet.
foo() {
echo "Parameter #1 is $1"
}
foo 2 # this will work.
Example 2: introduce parameters to programs in unix
$ function_name ram
hello ram
Example 3: introduce parameters to programs in unix
function_name()
{
echo “hello $1”
return 1
}