Thursday, May 13, 2010

Export, Set and Setenv commands

While installing many bioinformatics softwares you are required to set the environmental variable. Some of the softwares instructs you to set the variable using export and some using setenv but at times these commands do not work.

Ideally we would like to define a variable and it should be accessed in all the shells or processes invoked by the original shell. This can be achieved by the export command in ksh/sh as shown below.

export PATH="/root/satish/"

To check if the path has been set you could use the following command

echo $PATH and it should give you /root/satish/ has the output.

set and setenv are the c-shell (csh/tcsh) alternatives for setting a local variable and environment variable respectively. The set command is used for setting local variable, setenv is uesd for setting an environment variable:

To know what shell you are using type

echo $SHELL

the output will be /bin/bash or /bin/csh and so on. Depending on your shell use the above commands.

No comments:

Post a Comment