Re: [patch]: testsuite: run bash instead of sh when using brace expansion

Tom Tromey <[email protected]>
Newsgroups gmane.comp.gdb.patches,gmane.comp.gdb.devel
Message-ID <[email protected]>
>>>>> ">" == Christian Groessler <[email protected]> writes:

>> How about the following patch? My tcl fu is not that strong, so I
>> explicitly wrote out the expanded strings instead of computing them.

You can do something like:

set dirs {}
foreach l {/ldir ""} {
  foreach r {/rdir ""} {
    ... more foreaches here ...
      lappend dirs [join [list $l $r $...]]
  }
}

>> The shell command line could get quite long with this change,
>> depending how deep
>> the build directory is located in the hierarchy. I could invoke the
>> shell for each path separately, but
>> this would be slower. Any opinions?

If the result is too long we could batch it.
But I would not worry about it for now.

>> +proc reverse {lst} {

We have 'lreverse' in new Tcl, plus a compatibility proc in future.exp.

>> +proc pathexpand {prefix dirlst suffix} {
>> +    set retlst {}
>> +    for {set i 0} {$i < [llength $dirlst]} {incr i} {
>> +	lappend retlst "$prefix[lindex $dirlst $i]$suffix"
>> +    }
>> +    return $retlst

foreach is more idiomatic.

Tom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.