Operating System - HP-UX
1834144 Members
2138 Online
110064 Solutions
New Discussion

how to get the variable into string..

 
SOLVED
Go to solution
Ramana.Sv
Frequent Advisor

how to get the variable into string..

hai, when i use this command
echo$HOME i got the home sirectory name,

i want the to get the home directory name into string. how can i get this. please


Thank you,
Ramana
4 REPLIES 4
Oviwan
Honored Contributor

Re: how to get the variable into string..

you can use $HOME itself
or
newvariable=$(echo $HOME)

p.s. I have assigned points to 7 of 43 responses to my questions. don't forget to assign points, also in your other threads.
Dennis Handly
Acclaimed Contributor
Solution

Re: how to get the variable into string..

shell_variable="$HOME"
James R. Ferguson
Acclaimed Contributor

Re: how to get the variable into string..

HI Ramana:

# S=`echo ${HOME}`
# echo ${S}

...or, preferred by many:

# S=$(echo ${HOME})
# echo ${S}

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: how to get the variable into string..

If you are going to ask questions about shell scripting, you should really keep things neat and tidy by posting in the HP-UX languages and scripting forum. This also keeps the riffraff from confusing you. ;-)

More details. Shell variables can be strings or integers. In most cases the shell will do the right thing. You can use typeset -i to force it to be an integer, for improved performance.