Reputation: 9827
I'm trying to add some export statements in my Unix shell script and up to this point I've only gotten it to work with the bash shell. Is there a way to make the below export apply in all shells using shell scripting?
AXIS2_HOME=/home/user/axis2-1.6.0 export AXIS2_HOME
Upvotes: 0
Views: 101
Reputation: 29266
What do you mean "all shells?"
Then no, you can't. Exporting a var should mean all your children inherit it though. You can go some way to faking it by having your script create a temp file that you somehow get the caller to execute, but it's starting to get a biut weird and suggests a problem in your architecture.
You can make something like that work in all "sh" flavour shells, but for "csh" flavours you need to use setenv.
Depending how far you want to go, you could write something to store all your env. vars in a separate file (e.g. env.dat) and convert that to sh/csh syntax using sed/awk/perl.
Upvotes: 1