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!
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.
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 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.
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....
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.
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.
Maybe I'm wrong, but I think the "sourcing" 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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.