The UNIX and Linux Forums  

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
Running Sql scripts accross db2 jnimz Shell Programming and Scripting 4 10-23-2008 07:49 AM
Running scripts through cronjob. jitu.jk Shell Programming and Scripting 3 06-23-2008 07:33 PM
scripts running under different users csnewbie UNIX for Dummies Questions & Answers 1 02-14-2007 04:52 PM
Running scripts parallely santho UNIX for Dummies Questions & Answers 4 07-23-2006 01:42 PM
Running three scripts parallelly anwarsait Shell Programming and Scripting 1 07-18-2006 02:20 AM

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-11-2009
ravi.sri24 ravi.sri24 is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 9
Quote:
Originally Posted by otheus View Post
Since you are not understanding my posts, I will let someone else help you.

I understood you, you said when we run the su command with "-" you are saying it's will load the bin's profile but in my case it's not loading the bin's profile it's taking the root's environment variables only
  #2 (permalink)  
Old 02-11-2009
avronius avronius is offline VIP Member  
VIP Member
  
 

Join Date: Apr 2008
Location: Calgary
Posts: 305
First, identify the path that bin is using for home. Then, ensure that there is a .profile for bin:

Code:
ls -la /path_to_bin's_home_directory/bin

Then, write this script to see how the environment is changed using the ". /path/.profile" to change your environment.

Code:
#!/usr/bin/sh
/usr/bin/env > /tmp/default.environmentOutput

# This is where you will source the profile for your user
. /path_to_bin's_home_directory/bin/.profile
/usr/bin/env > /tmp/bin.environmentOutput

EDIT: Run using this command:

Code:
su - bin -c "/path_to_your_script/envCheck.sh"

/EDIT

This will create two files in /tmp
The first will show you the current environment variables.
The second will show you the NEW environment variables when you source the profile.

Test that - if you see a difference between the two files in /tmp, then you will see what the previous poster's are recommending. If you do not, then there is likely something wrong with the profile that you are sourcing - or you may be sourcing the wrong one.

Last edited by avronius; 02-11-2009 at 12:31 PM.. Reason: Changed for clarity
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 11:44 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