10-18-07 06:25 PM
On 2007-10-18, lak wrote:
>
> if i export a variable it exports to its child only.
> how can i export variables from child shell to parent?
You can't.
However, you can have a script print a value and assign that to a
variable in the parent:
val=$( your_script )
If you need to set more than one variable, have the script (or a
command that allows formatting of its output) print assignment
statements and use eval:
eval "$( date +"year=%Y month=%m day=%d" )"
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
[ Post a follow-up to this message ]
|