in reply to simulating bash

# Detect NAME=Value in shell script. # my $findShellVar = qr/\b([-A-Z0-9_]+)=\"(.*?)\"{1}?/sgc; # Detect embedded use of vars: NAME="text $VAR" # my $embeddedVar = qr/$\{?([-_[:alnum:]]+)\}?/gs; # For each line of the shell script, find shell variable # assignments, substituting the assigned value for any use # of other variables, and store result in hash. # while my $line ( <EBUILD> ) { if ( $line =~ /$findShellVar/ ) { my ( $k, $v ) = ( $1, $2 ); $v =~ s/$embeddedVar/$vars{$1}/; $vars{$k} = $v; } }

--
TTTATCGGTCGTTATATAGATGTTTGCA

Replies are listed 'Best First'.
Re: Re: simulating bash
by agaffney (Beadle) on May 13, 2004 at 17:57 UTC
    That does the same thing as my original code. It doesn't work with my example.