Thursday, August 9, 2012

how to introduce new variable, add path to script in linux environments using a console

adding a new path in console,

export  PATH=$PATH:/home/commands

this command with append the new path /home/commands to the environment, where, the console program check in the newly path for the commands, if commands are not found in the exsisting paths.

adding a new variable in console,

export  cd=/home/jai

 this creates a new variable next with value /home/jai . when cd is used along with the newly defined variable, it changes current directory to one /home/jai . 

cd $next
this  one changes the current directory to new one.

keyword/in-built console variable is used along with others because it make it possible to introduce a new variable or define paths at every time when the console open, hence export declares the definitions as global declarations

No comments:

Post a Comment