"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "script/envml" between
modules-5.1.1.tar.bz2 and modules-5.2.0.tar.bz2

About: The Environment Modules package provides for the dynamic modification of a user’s environment via modulefiles.

envml  (modules-5.1.1.tar.bz2):envml  (modules-5.2.0.tar.bz2)
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# ENVML, setup environment with module then run specified command # ENVML, setup environment with module then run specified command
# Copyright (C) 2015-2021 CEA/DAM # Copyright (C) 2015-2022 CEA/DAM
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or # the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
skipping to change at line 81 skipping to change at line 81
a '--' argument can be used. Without this '--' separator, first argument is a '--' argument can be used. Without this '--' separator, first argument is
considered module action and following arguments are part of command-line. considered module action and following arguments are part of command-line.
Examples: Examples:
$progpath restore command arg1 arg2 $progpath restore command arg1 arg2
$progpath purge:mod1:mod2 command arg1 arg2 $progpath purge:mod1:mod2 command arg1 arg2
$progpath restore load=mod1&mod2 -- command arg1 arg2" $progpath restore load=mod1&mod2 -- command arg1 arg2"
} }
# command help is asked # command help is asked
if [ $# -eq 0 -o "$1" == '-h' -o "$1" == '--help' ]; then if [ $# -eq 0 ] || [ "$1" == '-h' ] || [ "$1" == '--help' ]; then
echo_usage echo_usage
exit 0 exit 0
fi fi
# parse arguments # parse arguments
for arg in ${@}; do for arg in "${@}"; do
# reach separator, everything after is part of cmd # reach separator, everything after is part of cmd
if [ "$arg" == '--' ]; then if [ "$arg" == '--' ]; then
kind_of_arg='cmd' kind_of_arg='cmd'
else else
if [ "$kind_of_arg" == 'cmd' ]; then if [ "$kind_of_arg" == 'cmd' ]; then
cmdarglist+=("$arg") cmdarglist+=("$arg")
else else
for subarg in ${arg//:/ }; do for subarg in ${arg//:/ }; do
if [ "$kind_of_arg" == 'mod' ]; then if [ "$kind_of_arg" == 'mod' ]; then
modarglist+=("$(arg_into_modaction ${subarg})") modarglist+=("$(arg_into_modaction "$subarg")")
else else
maymodarglist+=("$(arg_into_modaction ${subarg})") maymodarglist+=("$(arg_into_modaction "$subarg")")
maycmdarglist+=("$subarg") maycmdarglist+=("$subarg")
fi fi
done done
# after first arg, we are not sure # after first arg, we are not sure
# following args are about module env # following args are about module env
if [ "$kind_of_arg" == 'mod' ]; then if [ "$kind_of_arg" == 'mod' ]; then
kind_of_arg='maymod' kind_of_arg='maymod'
fi fi
fi fi
skipping to change at line 129 skipping to change at line 129
else else
cmdarglist=("${maycmdarglist[@]}" "${cmdarglist[@]}") cmdarglist=("${maycmdarglist[@]}" "${cmdarglist[@]}")
fi fi
# check module function is defined # check module function is defined
if ! typeset -F module >/dev/null; then if ! typeset -F module >/dev/null; then
echo_error "module command not found..." echo_error "module command not found..."
fi fi
for arg in "${modarglist[@]}"; do for arg in "${modarglist[@]}"; do
module ${arg} module "$arg"
done done
# now execute the real command with its interpreter # now execute the real command with its interpreter
exec ${cmdarglist[*]} exec "${cmdarglist[@]}"
 End of changes. 7 change blocks. 
6 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)