Skip to content

Commit

Permalink
env: print usage for bad options (#461)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mknos committed Feb 14, 2024
1 parent 0a6e3b6 commit f533445
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/env
Expand Up @@ -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 });
}
}

Expand Down Expand Up @@ -87,12 +87,13 @@ I<env> 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<name>
Clears the environment variable I<name> if it exists.
The value must not include the '=' character.
This option may be repeated.
=back
Expand All @@ -103,7 +104,7 @@ status of the command. Otherwise, I<env> 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
Expand Down

0 comments on commit f533445

Please sign in to comment.