LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-14-2009, 05:18 PM   #1
RobertSubnet
LQ Newbie
 
Registered: Jun 2009
Location: Phoenix, AZ
Distribution: CentOS
Posts: 11

Rep: Reputation: 0
CentOS - run local profile at login


Hello all. Solaris user here trying to learn some Linux. CentOS in this case.

I have created a .profile file in my home directory to do things such as set: the path, a prompt, backspace as delete, etc.

When I login, the .profile file does not run. However when I execute it manually using . ./.profile it works just fine.

I checked the User Manager (?) and could not find where you set the file to use for local settings. If you wanted to use one at all that is.

I am using CentOS 5.3 and the Korn shell.

So my question: how does a person run a local profile file from their home directory during login? Or is there some other way of doing this using CentOS?

Thanks!
~Robert
 
Old 12-14-2009, 05:21 PM   #2
SethsdadtheLinuxer
Member
 
Registered: Jun 2007
Posts: 152

Rep: Reputation: 37
refer to this link
http://docsrv.sco.com/SHL_custom/The...and_kshrc.html
 
Old 12-14-2009, 05:25 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by RobertSubnet View Post
Hello all. Solaris user here trying to learn some Linux. CentOS in this case.

I have created a .profile file in my home directory to do things such as set: the path, a prompt, backspace as delete, etc.

When I login, the .profile file does not run. However when I execute it manually using . ./.profile it works just fine.

I checked the User Manager (?) and could not find where you set the file to use for local settings. If you wanted to use one at all that is.

I am using CentOS 5.3 and the Korn shell.

So my question: how does a person run a local profile file from their home directory during login? Or is there some other way of doing this using CentOS?

Thanks!
~Robert

I know this may be a silly question, but why bother with
Korn if you want to actually use Linux? Just use bash,
the default for the OS, and the weapon of choice for the
init scripts it uses.



Cheers,
Tink


P.S.: At least you weren't asking about csh ;}
 
Old 12-14-2009, 05:50 PM   #4
RobertSubnet
LQ Newbie
 
Registered: Jun 2009
Location: Phoenix, AZ
Distribution: CentOS
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
I know this may be a silly question, but why bother with
Korn if you want to actually use Linux? Just use bash,
the default for the OS, and the weapon of choice for the
init scripts it uses.
I guess I do not know enough about Linux to understand why Korn is not Linux.
 
Old 12-14-2009, 06:59 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,415

Rep: Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785
When Linux was first written, ksh (ksh88 ?) was still a closed src program, so they went with bash; highly ksh compatible (work-alike), but open src & free.
You could get pdksh (public domain ksh rewrite) but it wasn't that popular for obvious reasons.
Later on, ksh (ksh93 iirc) became open, but by that pt the default was bash.

Your choice as to which you use, but getting used to bash is prob a good idea. As I say, the 2 are very close in functionality. The main problem in porting scripts is external cmds/progs like find, which the GNU team have extended with extra options and in some cases altered. See the -maxdepth/-prune options between old school find and the gnu version.

HTH

Bash docs:
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/


PS: I've happily used both (worked on Linux/Solaris/HP-UX), but usually go with whatever my prod systems happen to be using; less confusing.
 
Old 12-14-2009, 07:19 PM   #6
RobertSubnet
LQ Newbie
 
Registered: Jun 2009
Location: Phoenix, AZ
Distribution: CentOS
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks guys for your replies. At work at the moment so don't have too much free time to digest all the replies. But I did want to write a quick thank you for the thoughtful answers!

~Robert
 
Old 12-15-2009, 03:46 PM   #7
RobertSubnet
LQ Newbie
 
Registered: Jun 2009
Location: Phoenix, AZ
Distribution: CentOS
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks again for the replies.

My problem is not writing a .profile or understanding the commands in a .profile, it is getting the thing to run at login.

My .profile file works, it just doesn't run at login.

So with CentOS 5.3 does anyone know how to get a .profile file to run at login? The file is located in the home directory.

Thanks!
 
Old 12-15-2009, 05:06 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
What does the line in /etc/passwd for your user ID look like?

Which package is your ksh from?


Cheers,
Tink
 
Old 12-15-2009, 05:21 PM   #9
RobertSubnet
LQ Newbie
 
Registered: Jun 2009
Location: Phoenix, AZ
Distribution: CentOS
Posts: 11

Original Poster
Rep: Reputation: 0
Tink:

It will be a couple of hours until I get home and can answer your question regarding /etc/passwd

My OS is CentOS 5.3. Not sure if that answers your question about which package ksh is from.

~Robert
 
Old 12-15-2009, 05:42 PM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,415

Rep: Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785
If you are using Centos, just the std install, the ksh should be the one from the repos and should work. It's possible that your login entry in /etc/passwd still says bash, not ksh.
Just FYI, as with ksh = .profile & .kshrc, the equiv files for bash are .bash_profile & .bashrc, although bash would (should ?) run .profile if no .bash_profile exists, iirc.
 
Old 12-15-2009, 06:06 PM   #11
RobertSubnet
LQ Newbie
 
Registered: Jun 2009
Location: Phoenix, AZ
Distribution: CentOS
Posts: 11

Original Poster
Rep: Reputation: 0
Is a colon

:

required at the top of the .profile script even though I am using a ksh? I am almost positive my .profile does not start with that.
 
Old 12-15-2009, 06:23 PM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,415

Rep: Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785
':' is the null statement, can't imagine you need that for anything.
What did your entry in /etc/passwd say?
What does

echo $SHELL

say?

cat /etc/shells

Last edited by chrism01; 12-15-2009 at 08:41 PM. Reason: Tidy up
 
Old 12-15-2009, 07:31 PM   #13
RobertSubnet
LQ Newbie
 
Registered: Jun 2009
Location: Phoenix, AZ
Distribution: CentOS
Posts: 11

Original Poster
Rep: Reputation: 0
I am still at work. Will post those results as soon as I get home, kiss the wife and kid and can get on the box
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SLES /etc/profile.local tritonsmoon Linux - Newbie 4 06-02-2009 03:03 PM
Need some help recovering from profile.local jhenager SUSE / openSUSE 2 09-26-2005 03:39 PM
what's the local profile for /bin/sh jackandking Linux - Newbie 3 05-13-2005 03:46 AM
cannot find local profile Peds222 Linux - Networking 2 09-11-2003 03:03 PM
.bashrc,profile.local Cichlid Linux - Distributions 1 01-08-2002 06:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration