![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 'while' loop does not change local variables?! | alex_5161 | Shell Programming and Scripting | 3 | 11-20-2008 02:06 PM |
| How to change parent shell's variables? | pankai | Shell Programming and Scripting | 1 | 01-17-2008 04:32 PM |
| can you change direcotry using variables? | jsalz638 | Shell Programming and Scripting | 4 | 07-06-2004 08:09 AM |
| What 's setenv? | myoeminn | Shell Programming and Scripting | 2 | 03-05-2002 09:24 PM |
| set, setenv | w6u6f | UNIX for Dummies Questions & Answers | 1 | 01-31-2002 04:58 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Why does set also change setenv variables?
I thought that set and setenv was easy enough to understand until I started experimenting.
I noticed the same problem in a previous thread, so I will use it as an example. set command gave the following output: argv () cwd /homes/e/ee325328/assignment.2 home /homes/e/ee325328 path ( a whole bunch of paths) prompt sol% shell /bin/csh status 0 term ansi user ee325328 setenv command gave the following output: HOME=/homes/e/ee325328 PATH=bla bla LOGNAME=ee325328 _INIT_PREV_LEVEL=S _INIT_RUN_LEVEL=3 _INIT_RUN_NPREV=0 _INIT_UTS_ISA=sparc _INIT_UTS_MACHINE=sun4d _INIT_UTS_NODENAME=sol _INIT_UTS_PLATFORM=SUNW, SPARCserver-1000 _INIT_UTS_RELEASE=5.7 _INIT_UTS_SYSNAME=SunOS _INIT_UTS_VERSION=Generic_106541-19 PWD=/homes/e/ee325328/assignment.2 USER=ee325328 OPENWINHOME=/usr/openwin The following variables are common to both: HOME PATH USER (but they are lower case for set and uppercase for setenv) When using the set command to change any of these, the setenv values are also affected, and vice versa. How is a variable common to the shell and the environment created? I tried creating a shell variable and an environment variable of the same name, but their values can be changed independently. Which leads to another question: If the value is different, which one takes precidence? Better stop and try and undertand what's going on before going any further. |
![]() |
| Bookmarks |
| Tags |
| shell script, shell scripting, unix scripting, unix scripting basics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|