Skip to content

Commit

Permalink
Merge pull request #407 from radical-cybertools/fix/expr_cmd
Browse files Browse the repository at this point in the history
updated `expr` usage for env funcs extraction
  • Loading branch information
mtitov authored May 21, 2024
2 parents 7c86772 + 766d268 commit 52964c6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/radical-utils-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,9 @@ env_prep(){

# handle bash function definitions
v=$(grep -e "^$k=" $src | cut -f 2- -d= | sed -e 's/{ /{\n/')
func=$(expr "$k" : '^BASH_FUNC_\(.*\)\(()\|%%\)$')
if ! test -z "$func"
func=$(expr "$k" : '^BASH_FUNC_\(.*\)()$' \
\| "$k" : '^BASH_FUNC_\(.*\)%%$')
if ! test -z "$func" && ! test "$func" = 0
then
functions="$func $v\nexport -f $func\n\n$functions"
else
Expand Down

0 comments on commit 52964c6

Please sign in to comment.