Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

ksh replace single qoutes in var.

SOLVED
Go to Solution
Occasional Visitor

ksh replace single qoutes in var.

Hi,

I kind of stuck on easy thing how to apply command I can use from prompt inside my ksh script.
I need to replace single qoute in my var,
this work ok from prompt:
$ echo $mm|tr -d "'"
.
but how put this into new var or change existing $mm value inside the script? I know how to do it with file, but d'like to stay with var.
e.g.
$ mmm=`echo $mm|tr -d "'"` # this gaves me an error.

Appreciate you help on this easy for you subject. I check my manuals it's all clear untill hands on sample.

Best
Tr

5 REPLIES
Honored Contributor Honored Contributor

Re: ksh replace single qoutes in var.

How about print ? Replace echo with print and try.
Regards
Shibin
Acclaimed Contributor Acclaimed Contributor

Re: ksh replace single qoutes in var.

>this gives me an error.

What does $mm have in it? What error do you have?
I have no problems with:
mm2=$(echo $mm | tr -d "'")
Highlighted
Regular Advisor Regular Advisor

Re: ksh replace single qoutes in var.

echo $mm
"This is a test"
nn=$(echo $mm | tr -d '"')
echo $nn
This is a test


Is this what you are looking for ?
Acclaimed Contributor Acclaimed Contributor

Re: ksh replace single qoutes in var.

Hi:

So, it appears that the suggestions offered solved your problem, based on point assignment. In that case, *exactly* what eliminated the error that you were encountering, and what *exactly* was that error?

Regards!

...JRF...
Honored Contributor Honored Contributor

Re: ksh replace single qoutes in var.

> [...] and what *exactly* was that error?

You weren't still hoping for a clear
statement of the problem, were you? This
_is_ the HP-UX forum, isn't it?