From 72961ad20ef9682e9b1239484ed68b75eadb035d Mon Sep 17 00:00:00 2001 From: Michael Mikonos <127171689+mknos@users.noreply.github.com> Date: Wed, 14 Feb 2024 11:30:17 +0800 Subject: [PATCH] env: print usage for bad options * If I typed the wrong option to env, e.g. -x, print the usage string to show the correct options (BSD version does this) * pod: clarify that the -u option can be used more than once * pod: words found by spell-checker --- bin/env | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/env b/bin/env index a17871c2..22d0b26c 100755 --- a/bin/env +++ b/bin/env @@ -37,8 +37,8 @@ while ( @ARGV && $ARGV[0] =~ /^-/ ) { } elsif ($arg eq '--') { last; } else { - warn "$Program: invalid option -- $arg\n"; - exit 2; + require Pod::Usage; + Pod::Usage::pod2usage({ -exitval => 2, -verbose => 0 }); } } @@ -87,12 +87,13 @@ I accepts the following options: =item B<-i> -Clears the environment, passing only the values specifed to the command. +Clears the environment, passing only the values specified to the command. =item B<-u> I Clears the environment variable I if it exists. The value must not include the '=' character. +This option may be repeated. =back @@ -103,7 +104,7 @@ status of the command. Otherwise, I will return one of the following values: 0 env completed successfully. - 1-125 An error occured in env. + 1-125 An error occurred in env. 127 There was an error running the command specified. =head1 BUGS