Group,

I have having a problem with spaces in individual elements of an array.

The space causes a single element to be seen as multiple elements.

Here is a sample run:

-----------------------------------------------------
[EMAIL PROTECTED]:~/bin> ./arraywithspace.sh
3.1.17(1)-release
got 6 parms
parm: arg1
parm: arg2
parm: arg
parm: 3
parm: arg
parm: four
[EMAIL PROTECTED]:~/bin> cat ./arraywithspace.sh
#!/bin/bash

declare -a Arguments=("arg1" "arg2" "arg 3" "arg four")

function countparms
{
   echo "got $# parms"

   while (($# != 0 ))
   do
      echo "parm: $1"
      shift
   done
}

echo $BASH_VERSION

countparms ${Arguments[*]}

------------------------------------------------------

The real problem I am having is using the array as a list of arguments
to a command, maybe something like this:

grep -i mypattern ${FileList[*]}

-- 
potter


Reply via email to