difference between EXPORT and setenv | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


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 !!

difference between EXPORT and setenv

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-07-2008
dexkid dexkid is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 7 February 2008, 1:22 AM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
difference between EXPORT and setenv

Hi,

Is there any difference between setting an environment variable by EXPORT and by setenv?
Sponsored Links
    #2  
Old 02-07-2008
vino's Avatar
vino vino is offline Forum Advisor  
Supporter (in vino veritas)
 
Join Date: Feb 2005
Last Activity: 9 April 2013, 8:19 AM EDT
Location: Sydney, Down Under
Posts: 2,847
Thanks: 0
Thanked 12 Times in 12 Posts
Quote:
Originally Posted by dexkid View Post
Hi,

Is there any difference between setting an environment variable by EXPORT and by setenv?
export and not EXPORT is used by sh and ksh shells. setenv is used by csh.

The syntax also differs for both.


Code:
export key=value
setenv key value

The Following User Says Thank You to vino For This Useful Post:
figaro (09-05-2010)
Sponsored Links
    #3  
Old 02-07-2008
dexkid dexkid is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 7 February 2008, 1:22 AM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Can environmental variables exported using export and setenv be accessible across different terminals?
Also do they persist for accessing via programs using "getenv()" call ?
    #4  
Old 02-07-2008
HPAVC's Avatar
HPAVC HPAVC is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 29 October 2009, 8:14 AM EDT
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
No there isn't a shared realtime environment in multiple shell sessions.

Typically you would setup some sort of profile to kick start the environment that is full of the variables (~/.profile, ~/.bashrc, ~/.tcshrc, etc) just like as well as employ the system wide equivalent /etc/profile and what not.

But not there isnt a: super_export TERM=vt100 that will force that variable to be inherited by all your running shells immediately.

The export and setenv calls typically are used for other programs or sub programs to use and shouldn't be confused with the 'set' variables in some shell scripts that are local for that shell sessions. Or that programs will set for themselves and their sub programs but will disappear when the program ends.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
typeset and export command difference systemsb UNIX for Dummies Questions & Answers 0 05-16-2006 11:36 AM
difference between set and export shriashishpatil UNIX for Dummies Questions & Answers 1 02-22-2006 12:28 PM
Difference between SET and SETENV 435 Gavea UNIX for Dummies Questions & Answers 2 11-10-2003 08:07 PM
What 's setenv? myoeminn Shell Programming and Scripting 2 03-05-2002 08:24 PM
set, setenv w6u6f UNIX for Dummies Questions & Answers 1 01-31-2002 03:58 PM



All times are GMT -4. The time now is 11:50 AM.