I am actually playing with arguments and its happened. I just thought like to see what will happen if I type $$1 and I did it and got something below.
raja@raja-BONEFISH:~$ $$1
19301: command not foundWhat's that 19301 mean, is it telling something?
Bottom-Line: what does meaning for $$1 in bash.
4 Answers
$$ is the PID (process id) of the current process.
$$1 is the above PID followed by the literal string 1.
So it is telling you that your bash is the process with PID 1930.
But... free trick:
show() { eval echo \$$1; }
show PATH
/home/romano/bin:/usr/local/bin:/bin:/usr/bin(quite convoluted, ain't it?)
More info in TLDP.
2$$- pid of the current shell (not subshell) - see What are the special dollar sign shell variables?$$1- pid of the current shell (not subshell) followed by1.$$2- pid of the current shell (not subshell) followed by2.$$a- pid of the current shell (not subshell) followed byacharacter.And so on...
See the output of echo $$1.
And you get the error command not found because you are trying to execute a string composed of digits which obviously is not a command.
You have concatenated $$ and 1 together to get the PID of the current shell and 1, i.e. $$ stands for the PID of the currently running shell and 1 is just a character, you could do $$a, $$@ to get the PID concatenated with the following character.
$$ it will state 1930 which is pid of current shell .
When you type $$1 that means pid followed by one so you the output would be 19301 .
Try $$2 the output will be 19302