sh: function

Two sample functions, the first with no arguments and the second with three arguments.

ScriptOutput
#!/bin/sh

exampleFunctionNoArgs()
{
    echo "Start exampleFunctionNoArgs"
}

exampleFunctionThreeArgs()
{
    echo "Start exampleFunctionFourArgs"
    echo "    All    Arguments: $@"
    echo "    First  Argument:  $1"
    echo "    Second Argument:  $2"
    echo "    Third  Argument:  $3"
}

echo "Start shell script"
exampleFunctionNoArgs
exampleFunctionThreeArgs Roger Was Here

Start shell script
Start exampleFunctionNoArgs
Start exampleFunctionFourArgs
    All    Arguments: Roger Was Here
    First  Argument:  Roger
    Second Argument:  Was
    Third  Argument:  Here

See Also: $*, $@


Roger
Roger Hall
COMPUSPEC
Google
 
Web Compuspec.net
Valid XHTML 1.0!
Valid CSS!