From 102b2f566a996cdabc13c9cf0b33552e962abeed Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Fri, 27 May 2016 12:02:11 -0500 Subject: [PATCH] Add PID Of The Current Shell as a unix til --- README.md | 3 ++- unix/pid-of-the-current-shell.md | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 unix/pid-of-the-current-shell.md diff --git a/README.md b/README.md index a0b402b..affd2da 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really warrant a full blog post. These are mostly things I learn by pairing with smart people at [Hashrocket](http://hashrocket.com/). -_424 TILs and counting..._ +_425 TILs and counting..._ --- @@ -386,6 +386,7 @@ _424 TILs and counting..._ - [List All Users](unix/list-all-users.md) - [Only Show The Matches](unix/only-show-the-matches.md) - [Partial String Matching In Bash Scripts](unix/partial-string-matching-in-bash-scripts.md) +- [PID Of The Current Shell](unix/pid-of-the-current-shell.md) - [Repeat Yourself](unix/repeat-yourself.md) - [Saying Yes](unix/saying-yes.md) - [Search History](unix/search-history.md) diff --git a/unix/pid-of-the-current-shell.md b/unix/pid-of-the-current-shell.md new file mode 100644 index 0000000..70d1ab5 --- /dev/null +++ b/unix/pid-of-the-current-shell.md @@ -0,0 +1,23 @@ +# PID Of The Current Shell + +`$` expands to the process ID of the shell. So, you can see the PID of the +current shell with `echo $$`. + +```bash +> echo $$ +36609 + +> zsh + +> echo $$ +45431 + +> exit + +> echo $$ +36609 +``` + +See the `Special Paramaters` section of `man bash` for more details. + +[source](http://stackoverflow.com/questions/21063765/get-pid-in-shell-bash)