#!bash perl_clean_env() { local warned value; for i in PERL_MM_OPT PERL5LIB PERL5OPT PERL_MB_OPT PERL_CORE PERLPREFIX; do # Next unless match [ -v $i ] || continue; # Warn only once, and warn only when one of the bad values are set. # record failure here. if [ ${warned:-0} == 0 ]; then if [ ${I_KNOW_WHAT_IM_DOING:-0} == 1 ]; then echo "Potentially bad ENV values found but I_KNOW_WHAT_IM_DOING=1"; else echo "Bad ENV values found. Please unset from ENV ( ~/.bashrc, package.env, etc ) or set I_KNOW_WHAT_IM_DOING=1" fi warned=1 fi # Read ENV Value eval "value=\$$i"; echo " $i=\"$value\""; done # If any failures occurred, die unless I_KNOW_WHAT_IM_DOING if [ ${warned:-0} == 1 ] && [ ${I_KNOW_WHAT_IM_DOING:-0} != 1 ]; then die; fi } perl_clean_env;