Thursday, May 26, 2005

What's the differene between "setenv" and "export" commands in Unix/Linux?

Actually it depends on what shell U are using...i.e. C shell or Bourne Shell.

There are 2 types of variables:
  1. Shell variables -- That are local to the shell
  2. Environment variables -- That are available to all other processes

In C-shell to set a shell variable U type: % set name=value

In bourne shell you can just type: $NAME=value

In C-shell to set an environment variable: % setenv [NAME value]

In bourne shell, U need to export the shell variable, so U type: $ export NAME

A good article explaning the differences is present at:

http://sc.tamu.edu/help/general/unix/vars.html