Monday, May 16, 2011

exporting variable in Shell

You can create your own environmental variables in shell

It is very simple just type export followed by your variable and the value.

For exporting a variable gg

export gg="hello"

echo $gg
hello
you will be able to see the content of the variable gg - "hello"

But it stays untill reboot.Once you reboot you have to set the variable again.

To make it permanent you can add it to /etc/profile to make the change visible for all users using your system or you can add the change to the ~/.bash_rc to make the change visible only for your shell.

No comments:

Post a Comment