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!

Setting profile

Status
Not open for further replies.

evergreean43

Technical User
May 25, 2006
165
US
I am trying to edit my .profile for my new account on Solaris 7 server.

Every alias I put in the .profile is not working.
Even this is not working:
PS1="myserver "

I set the permissions on my .profile correctly:
chmod 775 .profile

Please advise what I need to do?
Maybe my default shell is not ksh.
But I thought .profile worked in ksh only.
How do I find my default login shell and why isnt my aliases working in my .profile?

I even logged off and on still not working.
 
echo $SHELL to see what shell you're using - it should also be specified in /etc/passwd, but may be overridden by something in /etc/profile or .profile itself. Incidentally, permissions on my .profile are -rw-r--r-- (644), not 775.
 
Thanks,

Its csh.

I havent worked with c shell in a long time.

What is the equiv .profile in csh so I can set up my profile.

Also in future, how do I change my default to ksh or is that something only sys adm can do?
 
As far as I know, the csh equivalent is .cshrc (though I've never used it!!). It's probable that only your sysadmin can alter your default login shell.
 
The equivalent of .profile (sh or ksh) is .login (csh) and the equivalent of .kshrc (ksh) is .cshrc (csh). You can change shells from the command line by entering the shell name (eg: sh or ksh or csh or bash ) but to change your default login shell (as Ken says) you should ask your Sys Admin.

I hope that helps.

Mike
 
You would not use PS1 either. The setting you are looking for I believe is prompt.

Code:
set prompt = "$USER@`hostname`% "
 
You can use the Korn shell without having it changed in [tt]/etc/passwd[/tt]. Just have your [tt].cshrc[/tt] change you to the Korn shell. Do the following...

Make a link in your home directory to the Korn shell. It needs to be called "[tt]-ksh[/tt]".
Code:
ls -s /bin/ksh ./.-ksh

Put the following line in your [tt].cshrc[/tt] file...
Code:
exec -ksh

Then, set up your [tt].profile[/tt] and [tt].kshrc[/tt] files as you normally would. The only downside is that you will probably see the [tt]/etc/motd[/tt] file output twice, once while the c-shell is started and once while the Korn shell starts.
 

Two exits would be needed if the exec was not used. The difference being exec and fork system calls. Fork creates a new process (copies the current process for performance) and exec changes a process. With exec, the csh process chnages into a ksh process.
 
You don't have to do two exits because the [tt]exec[/tt] actually "replaces" the [tt]csh[/tt] with the [tt]ksh[/tt] in the same process. So you only have the one process to exit out of.
 
And the purpose of the link to [tt]-ksh[/tt] is that the incoming Korn shell will only process [tt].profile[/tt] and [tt].kshrc[/tt] if [tt]$0[/tt] starts with a dash. The link just fools it into thinking it's an initial login shell.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top