1) I have a variable with a list of variable names as its content, e.g.
'varlist=$var1 $var2 $var3'. I want to manipulate $varlist such that it
='var1 var2 var3', i.e get rid of the '$'s in front of each variable name.
A 'sed' example that I've tried is:
varlist=`echo "$varlist" | sed 's/$//'`
I've tried every variation I can think of with and without "s around
'$varlist', using single and double quotes for the sed command, and escaping
the $ with \. In short, nothing works -- it always comes back with '$var1
$var2 $var3'.
I did find that 'varlist=`echo $varlist | awk -F "$" '{print $2}'` does
work, but it seems there ought to be a way to do it with sed. Any idea what
I'm missing?
2) Given two variables, say var1="a" and var2="b", I want to create var3
such that it is "a<newline>b", i.e 'echo "$var3"' produces:
a
b
Combinations like 'var3=$var1\n$var2' end up as 'anb', i.e. the '\n' is not
treated as a <newline> character. Again, I've tried it with a variety of
quoting patterns, etc., all to no avail. So again...
Any
idea
what
I'm
missing?:)
bd
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list