What in the world does $$ mean?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers What in the world does $$ mean?
# 1  
Old 01-19-2010
What in the world does $$ mean?

If I type "echo $$" in to the command line it outputs some random number but it outputs the same one every time. What is this?
# 2  
Old 01-19-2010
Hi.

It's not a random number. It's the number of the process you're running (i.e. the current process).
# 3  
Old 01-19-2010
$$ will return the PID of your process so when typed into a terminal window it will return the Process ID of the shell you are in, when used in a script it returns the PID of the running script. $ is very useful for making a temporary file's name unique, e.g.
Code:
TMPFILE=/tmp/tempfile.$$
date > ${TMPFILE}
cat ${TMPFILE}

# 4  
Old 01-19-2010
Tools Process id

I think it returns your process id.
See the ps command for more info.
# 5  
Old 01-19-2010
Thanks a lot guys. It's an impossible thing to google because google doesn't accept symbol searches. Much appreciated.
# 6  
Old 01-19-2010
Quote:
Originally Posted by weexpectedthis
Thanks a lot guys. It's an impossible thing to google because google doesn't accept symbol searches. Much appreciated.
I think you make an excellent point! I've googled this myself and am none the wiser. Tried quotes, single quotes, backslashes, plusses, minuses. I even used the word "Please" once!

Is there anyone out there who can describe how to google special characters effectively?

PS: This thread will probably never appear in a Google search, so we might never know Smilie

Last edited by Scott; 01-19-2010 at 06:02 PM..
# 7  
Old 01-20-2010
Quote:
Originally Posted by weexpectedthis
Thanks a lot guys. It's an impossible thing to google because google doesn't accept symbol searches. Much appreciated.
true but google accepts normal searches and each special character has a name ... so a simple search on google for this like

Code:
unix OR "command line" OR shell "double dollar sign"

brings you the desired result.

Kind regards
zxmaus
 
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. What is on Your Mind?

Mad World Remix of Moby Video (Are You Lost In The World Like Me)

This is an excellent video comment on modern society and the remix is good too: https://www.youtube.com/watch?v=5DU1B_XkyIk 5DU1B_XkyIk Watch the video above and post your comments. (3 Replies)
Discussion started by: Neo
3 Replies

2. What is on Your Mind?

Hello World!

Just wanna say "Hello World!" :) (6 Replies)
Discussion started by: ment0smintz
6 Replies

3. Programming

Exact meaning of the "world" in "hello world"

Hello! I have a question to native English-speaking people. In the popular program's "hello world" greeting, what meaning the "world" has: "all", "everybody", "people", "friends" or "whole world", "planet", "Earth", "Universe"? In other words, to whom this greeting is addressed: to the... (14 Replies)
Discussion started by: Eugene Muzychen
14 Replies

4. What is on Your Mind?

How Will the World End?

How will the world end (someday long into the future, we hope)? (68 Replies)
Discussion started by: Neo
68 Replies

5. Programming

Almost -> Hello World!

Hello! I know I must take the efforts of learning C..! I need to recompile a binary with the following at the beginning: test if a file exists, remove it and exit. All in "C". As simple as this in sh: file=/tmp/filename if ; then rm -f $file exit 0 fi Thanks! (8 Replies)
Discussion started by: teresaejunior
8 Replies

6. What is on Your Mind?

What The World Needs Now...

What does the world need now.... ??? Feel free to suggest new items to the poll .... we might add them :) (25 Replies)
Discussion started by: Neo
25 Replies

7. Solaris

hello world

just wanted to give salutations to all in here. i hope to contribute as much as i take. happy "unix-ing" :b: (0 Replies)
Discussion started by: JeepResQ
0 Replies
Login or Register to Ask a Question