0

How can I print $$PARAMTER_NM=1234 in a Linux shell? I am getting the PID of my current process with $$, so the output is like:

1943PARAMTER_NM=1234

But I need:

$$PARAMTER_NM=1234
terdon
  • 242,166

3 Answers3

2
echo '$$PARAMTER_NM=1234'
$$PARAMTER_NM=1234
Hauke Laging
  • 90,279
1

You can protect the contents of the string from the shell in two possible ways:

  • Escape each $ like \$:

    echo "\$\$PARAMTER_NM=1234"
    
  • Use single quotes:

    echo '$$PARAMTER_NM=1234'
    
Kusalananda
  • 333,661
Enrico
  • 344
  • 3
  • 9
0
# echo "\$\$PARAMTER_NM=1234"
$$PARAMETER_NM=1234

If you want to use a special/reserved character with double quotes (such as $) as-is - you need to use an escape character ('\') right before it.

Alex
  • 116