The problem is:
The only EXPORTED variables are copyed.
I need many functions and declared not exported variables.
I am running functions which change and define variables.
Some of them need to be run in separate process, in '()': like >(funct_boo)
I do not want redeclare all functions, aliases and variables in the new process
src> alias boo="echo boo-boo"
src> foo()
> {
> echo "foo from func";
> }
src> foo
foo from func
src> boo
boo-boo
src> var=variable
src> echo $var
variable
src> hm
dca0701> bash
executing file .bashrc - starting the bash shell--
----> Start of the .myset file <---
----> End of the .myset file <---
src> foo
bash: foo: command not found
src> boo
bash: boo: command not found
src> echo $var
src>
The return() I have used, but it is not cover my situation.
There is a stack of functions, if somewhere something has not-0-return I need to stop execution of all stacked function, but do not kill the shell.
Return works only for one function.
bash has an -a option to automatically export all variables and functions, dunno if this is a bashism but I would guess it's POSIX. Try "set -a" at the top of the script.
In bash, it seems you can't export aliases. All the more reason to use functions instead of aliases.
Thank you, ERA, for advise, but I could not have it work.
Not sure where 'set -a' should be used:
in original shell, where function and variables are defined and where new shell is started
whith start shell command, like : >bash -a
in new shell after starting
I have tried all 3 way but do not have any success.
--193:/home/dca0701/develop/src> alias boo="echo boo-boo"
--193:/home/dca0701/develop/src> foo()
> { echo "foo from func"; }
--195:/home/dca0701/develop/src> var=variable
--195:/home/dca0701/develop/src> ec $var; boo; foo
variable
boo-boo
foo from func
--196:/home/dca0701/develop/src> bash -a
executing file .bashrc - starting the bash shell--
----> Start of the .myset file <---
----> End of the .myset file <---
--193:/home/dca0701/develop/src> ec $var; boo; foo
bash: boo: command not found
bash: foo: command not found
--193:/home/dca0701/develop/src> exit
--197:/home/dca0701/develop/src> set -a
--198:/home/dca0701/develop/src> bash
executing file .bashrc - starting the bash shell--
----> Start of the .myset file <---
----> End of the .myset file <---
--193:/home/dca0701/develop/src> ec $var; boo; foo
bash: boo: command not found
bash: foo: command not found
--193:/home/dca0701/develop/src> exit
--199:/home/dca0701/develop/src>
--199:/home/dca0701/develop/src>
--202:/home/dca0701/develop/src> bash
executing file .bashrc - starting the bash shell--
----> Start of the .myset file <---
----> End of the .myset file <---
--194:/home/dca0701/develop/src> set -a
--195:/home/dca0701/develop/src> ec $var; boo; foo
bash: boo: command not found
bash: foo: command not found
--196:/home/dca0701/develop/src>