2

I'm trying to get a string from the command line arguments, one of the arguments I'm trying to use is "$$". The argument resides in argv[2].

My program reads "$" fine (argv[2] = "$"), but when "$$" is used, argv[2] = "29628"....

  • What's going on here?
Filip Roséen - refp
  • 62,493
  • 20
  • 150
  • 196
JayB
  • 397
  • 6
  • 21

1 Answers1

2

$$ returns the process ID (pid) of the current shell.

Use a backslash to escape it: \$$.

Community
  • 1
  • 1
Emil Laine
  • 41,598
  • 9
  • 101
  • 157