Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Explaination on export command

$
0
0
Hello Team,

Could you pls explain how export command works in below code:

Code:

for i in ${!SDV_*}; do
        export $i
    done

As per my understanding, if
Code:

SDV_1=test1;SDV_2=test2;test1=var1;test2=var2
then in for loop below export will get executed.
Code:

export var1;export var2
But, Will this actually work like normal export command below?
Code:

export SDV_1=test1;
export test1=var1

Could you explain and correct me if wrong.

also i tried below and did not get the values in the new sessions.

On Same session:
Code:

$ var1=test1;
$ export var1;
$ echo $var1
test1
$ export var2;
$ var2=test2;
$ echo $var2
test2
$

On new session:
Code:

$ echo $var1

$ echo $var2

$

Regards,
Chandana

Viewing all articles
Browse latest Browse all 16232

Trending Articles