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 > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem in updating .profile file in HP-UX B.11.00 machine abhishek0071 UNIX for Advanced & Expert Users 3 02-07-2008 03:06 PM
updating a column in oracle table using shell script sveera Shell Programming and Scripting 3 05-09-2005 01:01 PM
Error updating profile woofie Post Here to Contact Site Administrators and Moderators 4 01-18-2005 05:20 PM
profile script vascobrito Shell Programming and Scripting 2 04-02-2004 01:32 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 02-03-2005
artfuldodger artfuldodger is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 5
Updating Profile from script

I am trying to figure a way to update an environmental variable in my .profile from script.

I have a variable name CON_DIR in my .profile.

I want to be able to update this variable directly via another unix script.

Any ideas?

Thanks.
  #2 (permalink)  
Old 02-03-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
What shell?
  #3 (permalink)  
Old 02-04-2005
artfuldodger artfuldodger is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 5
thanks

Korn shell
  #4 (permalink)  
Old 02-04-2005
encrypted's Avatar
encrypted encrypted is offline Forum Advisor  
Registered User
  
 

Join Date: Feb 2004
Location: Oslo, Norway
Posts: 219
In your script
export CON_DIR=<variable value>
  #5 (permalink)  
Old 02-04-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
I think that he wants to cause a permanent change to .profile so it will affect the next login. If this is true, in .profile I would do...
export CON_DIR=$(<condir.txt)
then put "/a/b/c" or whatever in condir.txt

Later, any script can put a different path in condir.txt to change the next login. The script can also change its envirornment as encrypted mentioned, but when the script exits, the parent shell will still have the old environment. So the parent might also need to change CON_DIR.
  #6 (permalink)  
Old 02-04-2005
artfuldodger artfuldodger is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 5
reply

I figured out a workaround. Not very elegant but does the trick.
Thanks.
Closed Thread

Bookmarks

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 09:50 AM.


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