Operating System - HP-UX
1752580 Members
3211 Online
108788 Solutions
New Discussion юеВ

Re: ksh replace single qoutes in var.

 
SOLVED
Go to solution
Trento
New Member

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 5
Shibin_2
Honored Contributor
Solution

Re: ksh replace single qoutes in var.

How about print ? Replace echo with print and try.
Regards
Shibin
Dennis Handly
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 "'")
Mike Miller_8
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 ?
James R. Ferguson
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...
Steven Schweda
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?