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:
@@ -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)
|
||||
|
||||
23
unix/pid-of-the-current-shell.md
Normal file
23
unix/pid-of-the-current-shell.md
Normal 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)
|
||||
Reference in New Issue
Block a user