Function need to be declared FIRST before it is used.
functionName(){
if [ "$1" == "1" ]; then
echo "paramether is 1"
else
echo "parameter is not 1"
fi
if [ "$2" != "" ]; then
echo "there is second parameter"
fi
}
and call it like this:
functionName
OR pass an argument:
functionName 1
OR more arguments:
functionName 1 aString
No comments:
Post a Comment