The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-21-2008
benwj benwj is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 1
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.
  #2 (permalink)  
Old 11-23-2008
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,116
The linkages between the 3 variables you mention were created by the author of csh at the time it was written. They are goofy and inexplicable. Please consider switching to ksh or bash. Their features make more sense.
  #3 (permalink)  
Old 11-24-2008
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,924
BTW, there are 4 linked variables on most versions of csh. The 4th is 'term'
Closed Thread

Bookmarks

Tags
shell script, shell scripting, unix scripting, unix scripting basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:50 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0