exec-if-not-env - Execute command if certain environment variable is false
This document describes version 0.02 of exec-if-not-env (from Perl distribution App-ExecIf), released on 2017-07-04.
Usage:
% exec-if-not-env RUN somecmd --cmdopt ...
The above will run somecmd only if RUN environment variable is not defined or false (with the notion of false follows Perl, i.e undefined, '', and 0 are false).
somecmd
RUN
''
0
99 on command-line options error.
Otherwise exit code from command is returned.
Yes, you can also do something like this in bash:
if [[ "$SOMEENV" == 1 ]]; then false; else somecmd --cmdopt ...; fi
But using this utility is simpler and more portable.
--help, -h
Please visit the project's homepage at https://metacpan.org/release/App-ExecIf.
Source repository is at https://github.com/sharyanto/perl-App-ExecIf.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-ExecIf
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
App::ExecIf
exec-if-env
perlancar <perlancar@cpan.org>
This software is copyright (c) 2017, 2013 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install App::ExecIf, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::ExecIf
CPAN shell
perl -MCPAN -e shell install App::ExecIf
For more information on module installation, please visit the detailed CPAN module installation guide.