Can anyone help me to understand the meaning of below line?
#!/usr/bin/perl
use File::stat;
...
sub rootdev { return (stat readlink)[0] == (stat "/")[0]; }
my @vols = shuffle map {/.*\/([0-9]+)/} grep {not rootdev} grep {-e readlink} grep {-l} glob("/dev/shm/v/*");
...
There is submodule like above, but I cannot understand the meaning of stat readlink)[0] == (stat "/")[0]
.
I got the answer.
The input of the submodule rootdev
is grep {-e readlink} grep {-l} glob("/dev/shm/v/*")
.
So, firstly get the filelist from /dev/shm/v/
directory and filter with grep
only for symlink.
Then check the device id(first array info of stat
function) and compare it with root device.
It's for checking the pointed device of symlink in /dev/shm/v
is root device or not to include or exclude whatever.