CompGuy2
Programmer
- Dec 6, 2001
- 1
When running a Bourne shell, I create a variable, display the variable, then export the variable. The display works OK, but the export does not. Why?
Here is the contents of myshell.sh
myVar="this is a test"
echo "The contents of myVar: $myVar"
export $myVar
Here is what happens when I run the shell:
$sh myshell.sh
The contents of myVar: this is a test
$echo $myVar
$
I am able to edit my .profile and create/export a variable, then successfully echo the variable from the command line. Why doesn't export work from my shell?
Thanks,
Brian
Here is the contents of myshell.sh
myVar="this is a test"
echo "The contents of myVar: $myVar"
export $myVar
Here is what happens when I run the shell:
$sh myshell.sh
The contents of myVar: this is a test
$echo $myVar
$
I am able to edit my .profile and create/export a variable, then successfully echo the variable from the command line. Why doesn't export work from my shell?
Thanks,
Brian