Skip to content

Instantly share code, notes, and snippets.

@partizanes
Last active May 24, 2017 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save partizanes/bde5b82f1cf3fef0875b0b11f13f485f to your computer and use it in GitHub Desktop.
Save partizanes/bde5b82f1cf3fef0875b0b11f13f485f to your computer and use it in GitHub Desktop.
sub isMounted {
my $checkThisMount = shift;
my $procMountFile = "/proc/mounts";
my@ mountAry = ();
open my $handle, '<', $procMountFile;
chomp(my @lines = <$handle>);
close $handle;
foreach (@lines) {
if ($_ =~ m/$checkThisMount/) {
return 1;
}
}
return 0;
}
print(isMounted("/dump1"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment