From 66e45b675c3849af78f50c5ad22cd376b399843b Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 2 Oct 2023 22:35:14 +0100 Subject: [PATCH] Prevent user trying to run dirs on "/" --- dirs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dirs b/dirs index 7838938..ddc4053 100755 --- a/dirs +++ b/dirs @@ -35,6 +35,10 @@ unless (-d $dir_path) { die "$dir_path is not a directory\n" } +if ($dir_path eq '/') { + die "You are not able to run 'dirs' on the root directory\n" +} + my $total_size = 0; sub calculate_size {