cp $1 /tmp/tempfile.$$
This will create a file whose name is something like /tmp/tempfile.14506, if
the pid number is 14506.
I don't understand this very much, why do we add $1 to it? I know $$ prints out the current PID of the process.
As you can see I am not very familiar with shell programming.