bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why must non-standard $IFS members be treated so differently ?


From: Chris F.A. Johnson
Subject: Re: why must non-standard $IFS members be treated so differently ?
Date: Sun, 29 Jul 2012 15:04:21 -0400 (EDT)
User-agent: Alpine 2.00 (LMD 1167 2008-08-23)

On Sun, 29 Jul 2012, Jason Vas Dias wrote:

Good day Chet, list -
I'm concerned about the difference in output of these functions with
the example input
given on the '$' prefixed line below (with 4.2.29(2)-release
(x86_64-unknown-linux-gnu)):

    function count_args     {                v=($@);  echo ${#v[@]}; }

   Always quote $@. Without quotes, it's the same as $*

function count_args     {                v=( "$@" );  echo ${#v[@]}; }

--
   Chris F.A. Johnson, <http://cfajohnson.com/>
   Author:
   Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]