How to export

Hi

I need to export some directpry path like below:

var1=/<>/<>/<>
export var1

This is my basic idea.
I tried export var1=/<>/<>/<>
after executing this in a shell i did an echo of the var1. But nothing happened.

Can you please help me with this.

I need to srite a script to export multiple directory files..

Thanks in advance
JS

What you have done seems right.

Did you do that in a shell script ? If so, you will have to source that shell script to see the changes in your shell.

source myscript.sh

What did you do ?

Hi Vino,
Thanks
Yes . I have done that in a shell script.
The below script got executed successfuly
i have the following in 1.sh
export var1=/<>/<>/<>
export var2=/<>/<>/<>
./2.sh

And i have the following in 2.sh
echo $var1

when i run 1.sh i get the echo run

But wat i wanted was
vi 1.sh
export var1=/<>/<>/<>
export var2=/<>/<>/<>

after i run the above script if i give aecho of var1 then it sholud give me the dir path

But this doesnot work.
It looks like the exporting is available to only the subscripts and once we come out of 1.sh(in the secondcase) the effect of export is lost .

Thanks in advance

hello,

Please run like this :
$ . ./1.sh
So whatever export variables inside the script 1.sh will be available in the shell.

Regards,
Thobias

Thank you for the answer
Regards