Hi Matthew,

Perhaps what I'm doing in the '$' case needs a bit more explanation.  The
following is a script segment that gleans variable names from the script in
which it is run:

        for varname in case select until while ; do
                varlist=`cat "$0" | grep "^[    ]*$varname " | sed 's/ \[
//' \
                | awk '{print $2}' | awk -F "$" '{print $2}' | sed 's/"//g'`
        done

This bit works as it's using the 'awk -F' alternative to the sed chunk I
posted in my first message.  I think the problem when using sed is related
to parameter expansion, since the variable names are live in the script.
IOW, when using sed, maybe it's working on the values of the variables
rather than the names of them?

I've tried pulling the sed (or 'awk -F') out of the above line, then using a
second line like...

        varlist=`echo "$varlist" | sed 's/\$//g'`

...but the resulting varlist still has the '$'s in it when done.

As you can see, I have an alternative, so this isn't critical, but I sure am
curious!  Maybe I'm just a fool for trying to throw away $ <g>.

As for the <newline> problem, I found that the following works:

        var=`echo -e "a\nb"`
        echo "$var"

The piece I wasn't aware of is the '-e' with echo, which enables the '\n'
and other special characters.

Thanks for your input!

bd



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to