ENV2(1) | User Contributed Perl Documentation | ENV2(1) |
env2 - Converts environment variables to various script languages.
env2 -from SHELL -to SHELL [-o DESTINATION_FILE] SOURCE_FILE
env2 --save [FILE]
env2 # displays help
Do you prefer running bash while the rest of the team runs tcsh? Or perhaps you learned csh and the system administrators only know ksh. What happens when they (or you) supply an initialization script to source? If any of these situations sounds familiar, then this may be the script for you.
env2 takes shell scripts of one flavor in and spits out scripts effectively equivalent in another dialect. We say "effectively equivalent" because it does not translate syntax such as if/else statements. Instead, the original (source) script is evaluated to determine what environment variables it modifies, and the effective values of those variables are simply expressed in the syntax of the destination script's dialect. Typically, this is all you really need for scripts that modify the environment.
NOTE: If you need to the conditionals and for-loops to be used for different situations (e.g. different host architectures), then simply use this script repeatedly as needed.
Future extensions may include aliases or <functions>. Supported languages currently include: bash, csh, ksh, modulecmd, perl, plist, sh, tclsh, tcsh, vim, yaml, and zsh.
NOTE: The file version is identified by an internally computed SHA1 hash similar to the way git does versioning. If you get a warning message about inconsistent hash, it means that somebody modified the file without updating the $SHA variable.
See -ignore, -reset, and -unsafe_clear.
_,ENV,ENV2,OLDPWD,SHLVL
See also -clear, -reset and -unsafe_clear.
See also -clear, -ignore and -unsafe_clear.
MANPATH PATH LD_LIBRARY_PATH DYLD_LIBRARY_PATH PERL5LIB
See also -clear, -ignore and -reset.
ENV2 environment variable contains default command-line arguments if defined.
To support YAML, this script uses the CPAN YAML module.
# Simple conversion env2 -from ksh -to csh -o setup.csh setup.ksh # Create a modules cmd for a new xyz tool version 1.0 TOOL_SETUP=$TOOLS/vendor_dir/xyz_tool/xyz-1.0/setup.script MDLDIR=$TOOLS/modules/tools/xyz env2 -from sh -to modulecmd -o $MDLDIR/1.0 $TOOL_SETUP # Dynamically use a script for another shell to set environment eval `env2 -from ksh -to $SHELL -o setup.csh setup.ksh`
env2 is copyright (C) 2003-2008 David C Black. All rights reserved. This code may is hereby made available under Apache 2.0 licensing.
David C. Black <dcblack@hldwizard.com>
2018-02-18 | perl v5.26.1 |