Friday, October 28, 2016

Function with arguments Shell script

Function with arguments Shell script



#!/bin/sh
# Define functions at begining of the script
test_function ()
{
echo " In test_function "
value1=$1
value2=$2
echo "value1 --> $value1"
echo "value2 --> $value2"
}

test_function1 ()
{
echo " In test_function "
value1=$3
value2=$4
echo "value3 --> $value3"
echo "value4 --> $value4"
}

test_function $arg1 $arg2
test_function1 $arg3 $arg4


No comments:

Post a Comment