Skip to content

Commit

Permalink
updated expr usage for env funcs extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
mtitov committed May 13, 2024
1 parent 7c86772 commit 766d268
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 766d268

Please sign in to comment.