#!/bin/bash # Name: fnctest # Syntax: fnctest 1111 2222 3333 # Purpose: Demonstrate positional parameters and function parameters # Date: 02.10.2003 # Author: Michel Bisson #--------------------------------------------------------------------------- ####################### # Function Definition # ####################### function fnc () { echo "Function positional parameters" echo '$0='$0 echo '$1='$1 echo '$2='$2 echo '$3='$3 return=1 } ######################################### # Show the script positional parameters # ######################################### echo '----------------' echo "Script positional parameters" echo '$0='$0 echo '$1='$1 echo '$2='$2 echo '$3='$3 echo '----------------' ######################################################## # Call the function with its own positional parameters # ######################################################## return=0 echo 'Variable $return before function ='$return fnc aaa bbb ccc echo 'Variable $return after function ='$return ######################################## # Show the positional parameters again # # To show the NON-inteference of the 2 # # positional parameter system # ######################################## echo '----------------' echo "Script positional parameters again" echo '$0='$0 echo '$1='$1 echo '$2='$2 echo '$3='$3 echo '----------------'