Skip to content

Commit f533445

Browse files
authored
env: print usage for bad options (#461)
* 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
1 parent 0a6e3b6 commit f533445

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

bin/env

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ while ( @ARGV && $ARGV[0] =~ /^-/ ) {
3737
} elsif ($arg eq '--') {
3838
last;
3939
} else {
40-
warn "$Program: invalid option -- $arg\n";
41-
exit 2;
40+
require Pod::Usage;
41+
Pod::Usage::pod2usage({ -exitval => 2, -verbose => 0 });
4242
}
4343
}
4444

@@ -87,12 +87,13 @@ I<env> accepts the following options:
8787
8888
=item B<-i>
8989
90-
Clears the environment, passing only the values specifed to the command.
90+
Clears the environment, passing only the values specified to the command.
9191
9292
=item B<-u> I<name>
9393
9494
Clears the environment variable I<name> if it exists.
9595
The value must not include the '=' character.
96+
This option may be repeated.
9697
9798
=back
9899
@@ -103,7 +104,7 @@ status of the command. Otherwise, I<env> will return one of the following
103104
values:
104105
105106
0 env completed successfully.
106-
1-125 An error occured in env.
107+
1-125 An error occurred in env.
107108
127 There was an error running the command specified.
108109
109110
=head1 BUGS

0 commit comments

Comments
 (0)