Pass arguments into a function - Bash Shell Scripting Directory For Linux / UNIX

Pass arguments into a function - Bash Shell Scripting Directory For Linux / UNIX

瀏覽:676
日期:2024-05-06
Shell functions have their own command line argument. Use variable $1, $2..$n to access argument passed to the function. The syntax is as follows: name(){ arg1=$1 arg2=$2 command on $arg1 } To invoke the the function use the following syntax: name foo bar...看更多