1819791 Members
3166 Online
109607 Solutions
New Discussion юеВ

.profile and .kshrc help

 
SOLVED
Go to solution
Scott_20
Occasional Advisor

.profile and .kshrc help

Good Day.
I'm building my first custom .profile and .kshrc and I was looking for some kool commands and what they do. for example, what do you do to set file completion in ksh, and kool stuff like that.
thx.
scott
I'm ok
3 REPLIES 3
G. Vrijhoeven
Honored Contributor

Re: .profile and .kshrc help

Hi Scott,

.profile and .kshrc options.

I suppose you use the korn shell.

you can use:
set -o vi # puts vi on at the command line (use / to search in history)
PS1=`uname -n`>"$PWD $" # to have machine name and dir name in prompt

do not forget to export the variables.

Hope this will get you started.

Gideon

Roger Baptiste
Honored Contributor

Re: .profile and .kshrc help

Setting prompt in .profile:
PWD=`pwd`
HOST=`hostname`
PS1='$HOST:$PWD>'
export PS1 PWD HOST

Setting history
set -o vi

Setting umask
umask 027

Shutoff messaging
mesg n

Appending to PATH
PATH=$PATH:xyz:xyz1
export PATH


These are not 'cool' commands but dull and necessary ones ;-)

-raj
Take it easy.
James R. Ferguson
Acclaimed Contributor
Solution

Re: .profile and .kshrc help

Hi Scott:

Have a look at the "Shells: User's Guide" for a discussion of shell features:

http://docs.hp.com/hpux/onlinedocs/B2355-90046/B2355-90046.html

Remember that you *never* want to change the default root shell, as defined in /etc/passwd', to be other than the Posix (sh) shell: '/sbin/sh'. Should you do this, you will end up with an unbootable system!

Since the Posix shell is a superset of the Korn shell, as provided by HP, I see no reason to use 'ksh'.

The 'vi' editor is set by default in the 'profile' provided in '/etc/skel/.profile' and file name completion (by pressing the ESC(ape) key twice) is part of the shell.

For my own sanity (and protection) I place the following aliases in my profiles:

alias cp='cp -ip'
alias mv='mv -i'
alias rm='rm -i'
alias rmdir='rmdir -i'

For ease of system identification I change the PS1 prompt to be:

PS1=`hostname`" # ";export PS1

...and I set a secure 'umask':

umask 027

Regards!

...JRF...