bug-bash
[Top][All Lists]
Advanced

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

Re: Syntax Question...


From: Linda Walsh
Subject: Re: Syntax Question...
Date: Sun, 14 Aug 2011 00:49:37 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666




` Michael Witten wrote:
On Sun, Aug 14, 2011 at 04:55, Linda Walsh <address@hidden> wrote:

` Michael Witten wrote:
On Sat, Aug 13, 2011 at 23:41, Linda Walsh <address@hidden> wrote:

${#${!name}[*]}
bash: ${#${!name}[*]}: bad substitution

It's probably what you're trying to avoid, but you'll probably have to
construct and then eval the right code by hand:

 $(eval "echo \${#$name[*]}")

bingo.  (sigh)

I refactored and am essentially using spaces to store the values in
a string, then when I want to check the, I throw them into an array and
manip.
e.g. (not showing all supporting code)

 declare -axr _plst_t='_plist_'
 declare -axl defined_PLists=()

add things to the list...

  plist="$_plst_t$plist"
  local -al plist_deps=( $plist )

{search for value in list, ...]

  unless ((found)) ; then
      plist_deps[${#plist_deps[*]}]="$subdep"
      eval "$plist=( "address@hidden" )"
  fi

You want this:

  unless ((found)) ; then
    plist_deps+=("$subdep")
    eval $plist='("address@hidden")'
  fi

Of course, isn't the variable `plist' supposed to be a reference to
your *string* variable that holds a space-separated list of items? In
that case, the last line should be:

  IFS=' ' eval $plist='"${a[*]}"'
---
Damn your good...! Thanks... (saw your other email as well...well fix the syntax....
my eyes are glazing over...from this script...)

Fortunately just started writing that section of code this afternoon and haven't put it in to use yet...

Just now developing a @list=dep dep dep,
to have a meta-list syntax for dependencies ...
Still checking as singles...

...but every once in a while
I need a good 'idiosyncratic',  assembly-language  -like challenge...

almost 1500 lines, not counting externally called support scripts -- though over 1000
of those are in 'library code'













reply via email to

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