Closed dspinellis closed 7 years ago
f should be exported:
export -f f
Thanks! Can we make this implicit when there is a call
statement?
Also, the following example also fails.
#!/usr/bin/env dgsh
f()
{
echo hi | paste
}
export -f f
call f
[dds@stereo dgsh]$ example/5x5.sh
bash: --dgsh-negotiate: invalid option
Usage: bash [GNU long option] [option] ...
bash [GNU long option] [option] script-file ...
GNU long options:
--debug
--debugger
--dump-po-strings
--dump-strings
--help
--init-file
--login
--noediting
--noprofile
--norc
--posix
--rcfile
--restricted
--verbose
--version
Shell options:
-ilrsD or -c command or -O shopt_option (invocation only)
-abefhkmnptuvxBCHP or -o option
The following also fails with the above message
#!/usr/bin/env dgsh
row()
{
dgsh -c --dgsh-negotiate 'echo hi | paste'
}
export -f row
call row
The following works:
#!/usr/bin/env dgsh
row()
{
dgsh -c 'echo hi | paste'
}
export -f row
call row | cat
Why it works:
call
stands for bash --dgsh-negotiate
, which implies it is part of a dgsh pipelinedgsh
command within the function is standalone and therefore it should not negotiateIndeed it works. But we must make it more intuitive.
Fixed in fd923aa