Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

echo the variable ... 1

Status
Not open for further replies.

hokky

Technical User
Nov 9, 2006
170
AU
Hi guys,

Here's my example

Code:
one=start
two=$one

$$ echo $two
start  --> I want the result is $one, how do I do that?

Hi guys, this is simple question, but I couldn't get it out...

I want to echo $two and the result is $one, anybody can tell me how do I do that ?

Thanks guys
 
one=start
two=[!]'[/!]$one[!]'[/!]
echo $two

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
sorry PHV,

one more question

what about if I wanna get it back without typing it again.

I've tried this, but doesnt work :
Code:
test_function(){
    name=`$two | sed 's/\'//g'`
    echo "$name"

}
 
Sorry, I don't understand what you want to do.
 
Sorry,

I'll give you closer example
Code:
test_function(){
    echo $1
    name=`echo $1 | sed "s/\'//g"`
    $name
}

test_function '$ENVIRONMENT_VARIABLE/path/of/script/scriptname.ksh'

I want to echo the script after that run it.
 
use the eval builtin to have the shell re-expand the variable:

Code:
test_function(){
    [b]eval [/b]echo $1
    name=`[b]eval [/b]echo $1 | sed "s/\'//g"`
    $name
}

HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top