1

trying to create a file with following data using shell script.

InsertParam.sh

echo "$$Domain=XYZ" >parameter.prm

when i run InsertParam.sh Am getting out put as

$cat parameter.prm
1979205Domain=XYZ

Please help me how to over come this in my parameter.prm

i need Data as

$$Domain=xyz
bhargav reddy
  • 33
  • 1
  • 3
  • 12

1 Answers1

2

In sh/bash/ksh/zsh, $$ is the current PID. see https://www.gnu.org/software/bash/manual/bashref.html#Special-Parameters

You need to use different quotes to prevent that variable from being expanded:

echo '$$Domain=XYZ' >parameter.prm

see https://www.gnu.org/software/bash/manual/bashref.html#Quoting


Quotes can be mixed, as required:

echo '$$Domain='"$domain" >parameter.prm
glenn jackman
  • 238,783
  • 38
  • 220
  • 352
  • when i use single quotation mark can i use reference variable instead of value. EX **domain=xyz echo '$$domain=$domain'** so i can change domain name – bhargav reddy Sep 30 '16 at 10:27