Juozas's Dump

A growing collection of anime, photos and any other kind of weird content.
[Tumblr|​X/Twitter|​Pillowfort|​Loforo|​Mastodon] [Random post]

 tags  journal  gallery  RSS

20.2.2022 08:57:14


reposted by memes
19.2.2022 22:08:16 reposted from linux

Double dollar sign ($$) in bash

It substitutes to PID of the current running shell. For example running

ps -Alf|grep $$

generates interesting results, as shown below

$ ps -Alf|grep $$
0 S juozas     11125   11120  0  80   0 -  3391 do_wai 22:43 pts/0    00:00:00 bash
4 R juozas     11197   11125  0  80   0 -  3506 -      22:46 pts/0    00:00:00 ps -Alf
0 S juozas     11198   11125  0  80   0 -  2859 pipe_w 22:46 pts/0    00:00:00 grep --color=auto 11125

Another example is to use it in the file names where it gets substituted with the PID of the current running shell.

$ cat >f$$.txt <<EOF
This is a test. The pid of running shell is $$
EOF
$ cat f$$.txt
This is a test. The pid of running shell is 11125
$ ls f$$.txt
f11125.txt
$ LC_ALL=C rm -v f$$.txt
removed 'f11125.txt'
18.2.2022 19:55:18 reposted from memes

18.2.2022 19:22:09 reposted from birds

18.2.2022 18:08:21 reposted from birds

18.2.2022 17:59:03 reposted from fail

16.2.2022 20:29:53 reposted from memes

16.2.2022 20:26:53 reposted from memes

16.2.2022 20:25:13 reposted from demotivational

16.2.2022 20:06:54

16.2.2022 19:47:57

16.2.2022 14:31:47 reposted from demotivational

from https://carmenluna.loforo.com/bk53r

15.2.2022 20:39:12

15.2.2022 20:35:57

15.2.2022 20:25:30 reposted from demotivational

15.2.2022 20:05:32


reposted by cats
15.2.2022 19:40:16

15.2.2022 19:28:07

15.2.2022 19:23:17


reposted by memes kalesor
15.2.2022 06:12:14

1192894190144

from https://twitter.com/gayocats/status/1493437419344982021


reposted by cats
13.2.2022 20:38:10 reposted from cats


reposted by abledowa
13.2.2022 17:28:16 reposted from foxes

from https://tokyomews.loforo.com/6nefu

13.2.2022 15:19:11


reposted by memes kalesor
13.2.2022 14:44:51


reposted by memes
 
▼ see more... ▼
 

Timeline speed: 5.00 posts per day

Just 44 pages to end...

login