Showing posts with label setenv. Show all posts
Showing posts with label setenv. Show all posts

Wednesday, 30 September 2015

Difference between setenv and set in csh

To findout difference between set and setenv first look at below example.



So, from above example, it can be conclude that set is setting a variable ,which has scope only to that terminal. Variable using set has no scope in scripts running from that terminal.

setenv has scope in terminal as well as in running scripts from that terminal. But any variable with same name is setting using set command and setenv command then set command is overwrite the value of that variable for terminal, but from scripts only variables using setenv can be access.

So, set has visibility only to terminal and can't be access from scripts.
setenv has visibility to both to terminal  and scripts, but set has more priority than setenv for terminal.