1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 15:18:01 +00:00

Add PID Of The Current Shell as a unix til

This commit is contained in:
jbranchaud
2016-05-27 12:02:11 -05:00
parent 22c1e1aae9
commit 102b2f566a
2 changed files with 25 additions and 1 deletions

View File

@@ -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)

View File

@@ -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)