I am to write a subscript (called echomyvar) that displays the PID of the process running the script and the value of the variable named myvar. In the text it has:
$ cat echomyvar
echo The PID of this process is $$
echo The value of myvar is: $myvar
$ echo $$
2651
$ ./echomyvar
The PID of this process is 4392
The value of myvar is:
I was able to create the file echomyvar. So far I have
#!/bin/bash
echo 'The PID of this process is $$'
echo 'The Value of myar is: $myvar'
I do not know if that is even correct. I am supposed to reproduce what was in the text.
"
) for variables to be expanded.$$
contains the PID of the shell/script itself. – sebasth Sep 03 '17 at 22:57