Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sourcing .profile in korn 1

Status
Not open for further replies.

maunir

MIS
Apr 30, 2002
62
US
Can someone tell me how to do sourcing once in korn shell. Cause whenever I open up a new terminal, or whenever I login, I have to do a source on .profile everytime. I can't find help anywhere.
 
If my understanding of what you're asking is correct, you need to make sure that the .profile exists in the user's home directory, ie that you assigned when creating the user. The home directory can be found by grepping for the user in /etc/passwd:

grep <username> /etc/passwd

This will give you something like:

user1:x:1001:101::/export/home/user1:/usr/bin/ksh

where /export/home/first is the home directory.

Then just copy the .profile to the user's home directory. Hope this helps - post back if further details are required.
 
thanks for the update but i already knew about that...but the isssue is that he has updated his .profile and saved it thru vi. Then i helped him source it so the changes could take effect. So, now the changes work, but as soon as he closes that terminal window and pops open a new one he has to source it again, the changes are not saved for the new terminal. This happens even if he logs out and logs back in. It shouldn't matter if his home dir. is local or not should it? I checked the permission and ownership and its o.k.
 
Sorry - still can't quite get my head around what you mean by 'source it'. Can you clarify, please, possibly be giving an example of the commands you're executing to 'source' the .profile. Thanks.
 
So let's say i saved it after i made changes in .profile.
To source I do is #. ./.profile so now the new changes have taken effect. But, as soon as i close the window or terminal and open a new window or terminal, i have to do the sourcing again...which is not suppose to happen as cause if you do the sourcing once the changes are suppose to be saved and i don't have to do it again and again.....thanks for all the help
 
Very curious. I assume you're absolutely certain that the changes you have made to .profile in the first session have in fact been saved (ie by using wq!). Another suggestion is to be absolutely sure that the .profile is in fact in the user's home directory (as mentioned above, use ls -la | pg, .profile should be near the top)and not elsewhere. Post back if this doesn't help - I'll have a think over lunch!
 
Yup, already checked thru all of that...let me know if you get any ideas on this. I will try to get help from my peers...
thanks
 
Try putting an echo statement in the .profile

echo &quot;reading .profile&quot;

this will prove if you .profile is in fact being read.

Probably stating the obvious, but you are definitly using a korn shell and not a csh ?
 
I got that working and it's reading the profile...but my problem lies with this command.
set -o vi...i'm using this so that i could use my ESC key and K to move back and forth with my commands on my command line...i should have stated that the rest of the stuff work....like example it picks up my loginname and my pwd...sorry about that....does that line in .profile needs to be set at a specific spot or anywhere is fine....so to test this out..i type 2 or 3 commands on my new window and than i press esc and k and it comes up with ^[k...instead of going back & forth...
 
Is your login shell (from /etc/passwd) actually sh, and do you access ksh from within your .profile? If the latter is the case, your ksh needs to be before the set -o vi in the .profile for the latter (set -o vi) to work. Let us know.
 
Another possibility - check that set -o vi appears after the PATH variable is set.
 
I have tried this ;-
Save my current .profile away
Created a new .profile with these two lines :-

echo &quot;Reading .profile&quot;
set -o vi

The permissions of .profile are -rw-r--r--
I have a ksh set in my /etc/passwd entry

Now when I login, this works perfectly and i can use esc k to recall my commands.

Could you try this ?
 
I have the same thing as you do same permission, my ksh is in my passwd file, and my command is after the PATH entry....I tried creating new .profile and same results....
 
I guess I am running out of ideas with this one.

I did wonder if there was something odd with your keyboard or keyboard mapping, but then it still wouldn't work after you have set -o vi at the command line.

Over to you Ken !!!

 
yeah i'm running out of ideas on this one...i'm browsing the net on this...but no luck...if i do get any solutions i will let you guys know....thanks for all your help....

[mad]
 
Hello everyone:

I use K-Shell on my oracle servers. Below is an example of the .profile we use:

stty istrip
PATH=/usr/bin:/export/home/OraHome1/bin:/usr:/bin:/opt/SUNWut:/usr/sbin:/usr/loc
al/bin:/usr/java1.2/bin:/usr/ucb
export PATH
ORACLE_HOME=/export/home/OraHome1 ; export ORACLE_HOME
ORACLE_SID=DEV2;export ORACLE_SID
ORACLE_TERM=xterm;export ORACLE_TERM
ORACLE_BASE=/export/home/OraHome1 ; export ORACLE_BASE
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/openwin/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/dt/lib:/usr/ucblib:/usr/local/lib
export LD_LIBRARY_PATH
PATH=$PATH:/bin:/usr/bin:/opt/bin:/usr/ccs/bin:
PATH=$PATH:/opt/local/bin:/$ORACLE_HOME/bin:/usr/share/man/man2/../.u
export PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=$CLASSPATH:$ORACLE_HOME/network/jlib:/oracle/JSQLConnect2_24/JSQLConne
ct.jar
ulimit -n 1023
export TERM=vt100
stty erase ^h
export ENV=$HOME/.kshrc

The last line is where I reference the .kshrc file. The contents of this file are:
box=`/usr/ucb/hostname`
user=`/usr/ucb/whoami`
PS1='
$PWD
${user}@${box} > '
export PS1
set -o vi

Using variations of these two files should get you to where you want to be. Make sure that the .profile and .kshrc files have approriate permissions and ownership.
 
Sometimes i've had problems with this, and found that setting EDITOR fixes it :
EDITOR=vi ; export EDITOR
It's worth a try anyway.
Mike
 
You could try 'ksh -o vi', just to ensure that you are in the K Shell.

Krish
 
Finally I got it to work.....this is how I did it...

PS1='$LOGNAME'@[`hostname`]['$PWD']:
EDITOR=vi
export EDITOR
ksh -o vi

and somehow sourcing didn't take any changes...so i had to logout and log back in and that did it i guess....but sourcing should have taken the changes and propogated it to the other windows and terminals...but who cares as long as it worked it's fine w/ me.

thanks for all your help....[2thumbsup]
 
Maybe I'm wrong, but I think the &quot;sourcing&quot; problem is due to the /etc/profile file. I think if your remove it (rename) your sourcing problems will disappear. I can't remember if /etc/profile gets executed if there is a .profile in the User's home directory. I hate to say this but you might want to check the Man pages. I don't have access to a Unix system right now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top