Forum Moderators: bakedjake

Message Too Old, No Replies

Modify a variable in Korn Shell

         

sjau

5:41 pm on Jan 7, 2004 (gmt 0)

10+ Year Member



I'm just writing a little Shell Script that output Apache Virtual Host entries but for the ReWrite Rules I need to modify a variable:

e.g.

I have:
$DOMAIN="domain.com"

buthow can I modify it to:
$DOMAIN="domain\.com"

Is there a way to do so?

sjau

P.S.: It should also work with 2-letter TLDs also.

SeanW

8:03 pm on Jan 7, 2004 (gmt 0)

10+ Year Member



bash-2.05a$ DOMAIN="foo.com.tld"
bash-2.05a$ echo $DOMAIN
foo.com.tld
bash-2.05a$ DOMAIN=`echo $DOMAIN ¦ sed 's/\./\\\./g'`
bash-2.05a$ echo $DOMAIN
foo\.com\.tld

That's bash but should work in korn.

Sean

sjau

7:57 am on Jan 8, 2004 (gmt 0)

10+ Year Member



Thx,

that works fine :)