![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| current running process in shell | moco | Shell Programming and Scripting | 1 | 04-12-2007 12:15 AM |
| How do i execute script in the current shell | Naresh Kumar | Shell Programming and Scripting | 5 | 06-12-2006 12:55 PM |
| Command to findout the current shell? | Aceform | UNIX for Dummies Questions & Answers | 5 | 09-07-2005 01:00 PM |
| current shell | mkan | Shell Programming and Scripting | 3 | 02-21-2005 07:20 AM |
| How do you know what your current shell is? | shad0w75 | UNIX for Dummies Questions & Answers | 4 | 06-13-2003 03:01 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to run a new shell with copy of current shell declarations?
How to run another shell and have all current shell dectaration copied to that new shell?
I would like to have available all current declarations in a new shell. That are functions, aliases, variables. I need to test some functions that use the 'exit', but running it in current shell on 'exit' will close the shell, which I do not like. |
|
||||
|
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 Code:
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. Is any other possibility exist? |
|
||||
|
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. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|