Search This Blog

Monday, July 18, 2016

export.. Always a confusion to developer

I bet, more than fifty percent of unix users confuse to use export even they encounter it in many scripts however.

This small example clears all your exported confusions.

To give a definition to export as usual:

It is a unix built-in command to mark a variable to export to child process(s).


Example (No export):

>>myvariable=10
>>echo $myvariable
10
>>cat export_test_script

echo $myvariable

>>
>>./export_test_script
>>


Example (With export):

>>export myvariable=10  (use export myvariable if myvariable  is already defined)
>>echo $myvariable
10
>>cat export_test_script

echo $myvariable

>>/export_test_script
10
>>




No comments:

Post a Comment