1844834 Members
4255 Online
110233 Solutions
New Discussion

Custom Prompt

 
SOLVED
Go to solution
akdkumar
New Member

Custom Prompt

How do I customise shell prompt to display current working directory in HPUX?...
12 REPLIES 12
Arunvijai_4
Honored Contributor
Solution

Re: Custom Prompt

Hello,

Just put this line at the end of your /etc/profile or .profile

export PS1='`hostname`: ${PWD}>'

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Muthukumar_5
Honored Contributor

Re: Custom Prompt

It is simple as,

export PS1="${PWD} #"

--
Muthu
Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: Custom Prompt

It is permanent to that shell. That is.. it is temporary only. To make permanent then put it in your $HOME/.profile or /etc/profile file as,

export PS1="${PWD} #"

--
Muthu
Easy to suggest when don't know about the problem!
Devender Khatana
Honored Contributor

Re: Custom Prompt

Hi,

A better option will be to also display current hostname as well alongwith current directory. To achive this put this entry in /etc/profile

export PS1=`hostname`:'$PWD>>'

Also if te same is required to be in GUI mode then unmark the last line in .dtprofile, of that user's home directory.

HTH,
Devender
Impossible itself mentions "I m possible"
Cem Tugrul
Esteemed Contributor

Re: Custom Prompt

Hi,
Just put this line at the end of your /etc/profile or .profile

PS1="`tput bold``uname -n``tput rmso` \$PWD > "
export PS1

Good Luck,
Our greatest duty in this life is to help others. And please, if you can't
Cem Tugrul
Esteemed Contributor

Re: Custom Prompt

Hi,
Just put this line at the end of your /etc/profile or .profile

PS1="`tput bold``uname -n``tput rmso` \$PWD > "
export PS1

Good Luck,

Ps;Please do not forget to submit points!!!
:-))
Our greatest duty in this life is to help others. And please, if you can't
Sivakumar TS
Honored Contributor

Re: Custom Prompt


Hi,

Add the following line in

.profile

export PS1="${PWD}#"

With Regards,

Siva.
Nothing is Impossible !
Raj D.
Honored Contributor

Re: Custom Prompt

Hi Akdkumar ,

Just use PS1 to set your customized shell prompt as many example mentioned above.
[Details # man sh-posix ]


You can also set the prmpt in .profile , by putting like this :

export PS1="`hostname` : $PWD>> : `date |awk '{print $1 $2 $3}' ` >>"


Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
akdkumar
New Member

Re: Custom Prompt

Hi All

Solution Accepted.

Thank You.
Arunvijai_4
Honored Contributor

Re: Custom Prompt

Hi,

You can close this thread, if you found a solution.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
akdkumar
New Member

Re: Custom Prompt

Solution received from multiple respondents
Steven E. Protter
Exalted Contributor

Re: Custom Prompt

Shalom akdkumar,

Usually PS1 is customized in ~/.kshrc file.

Some admins put it in /.kshrc

Customizing PS2 might cause confusion because what is there by default is expected by most admins.

Congrats on your solution.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com