Elementolab/How to set env var

From Icbwiki

Revision as of 22:12, 7 April 2011; view current revision
←Older revision | Newer revision→
Jump to: navigation, search

Back to Elementolab/

Back to Elementolab/ChIPseeqer_Tutorial

HOW TO SET AN ENVIRONMENTAL VARIABLE

  • OPTION 1:

Easiest way, but do not forget the inverted quotes ! it's `pwd` and not pwd, 'pwd' or "pwd":

 export CHIPSEEQERDIR=`pwd`

Alternative on some platforms:

 setenv CHIPSEEQERDIR `pwd`
  • OPTION 2:

Using OPTION 1 will only set the variable for the current session. Once you log out, it will be removed, so next time you log in (open the Terminal again), you would have to add it again.

The way to modify the path variable permanently is to edit the bash_profile file (assuming you are using the default bash shell).

To edit the bash_profile, go to your home directory (ie: /home/myname) and type the command:

vi .bash_profile (note the fullstop before 'bash'. This '.' makes it a hidden file)

In that file write:

export CHIPSEEQERDIR=\the_path_to_ChIPseeqer


To run the tools directly from any folder, you need to add the $CHIPSEEQERDIR and $CHIPSEEQERDIR/SCRIPTS to your $PATH variable.

To do this edit the .bash_profile file as previously, and add to the end of the path variable, the CHIPSEEQERDIR variable (remember to use the ':' between directory names). For example:

export PATH=$PATH:$CHIPSEEQERDIR


IMPORTANT:

  • To write in vi: type i to enter 'insert' mode
  • To exit 'insert mode in vi: press the escape key AND
type :w to write the file OR
type :q to quit the vi editor
  • To test if the variable is set type:
printenv CHIPSEEQERDIR
  • If the variable is not set:
    • restart the terminal OR
    • go to your home directory (ie: /home/myname) and type the command:
source .bash_profile
Personal tools