1

Bash Passing An Array

view story
linux-howto

http://www.unix.com – Good grief so this should be easy. Passing an array as an argument to a function. Here is the sample code: Code: #/bin/bash function foo {   local p1=${1}   local p2=(${2})   local p3=${3}   echo p1 is $p1   echo p2 is $p2   echo p3 is $p3 } d1=data1 d2=data2 a=(bat bar baz) foo "${d1}" "${a[@]}" "${d2}" Obviously, it prints data1 bat bar And what I want is: data1 bat data2 I would take data1 bat bar baz data2 As that would still be workable. I'm simply trying to stuff the array into the second argument somehow that (HowTos)