Results 1 to 5 of 5

Thread: KSH prompt help!

  1. #1

    KSH prompt help!

    HELP! I'm trying to design my KSH (korn shell) prompt to look like my bash promt, and have the current directory name as part of it. Say for instance I'm in /home/sysop on host epoch the prompt would read:

    [sysop@epoch sysop]$ and if I change to say /etc it would show:
    [sysop@epoch etc]$

    With bash this is easy, the W shows this, so their prompt is like:

    PS1="[\u@\h \W]\\$ "

    How can I do the same with Unix? I know that basename `pwd` will show it, but how can I get this into my prompt, and update when I change directories!?!?!

  2. #2
    Join Date
    Dec 2001

    Re: KSH prompt help!

    I remember having to do this for csh, but it should be a similar I recall you have to alias the cd command to update the prompt. So something like
    "'alias cd '\!* ; set prompt="`hostname`:$cwd % "'

    It's a kludge, but it works. This site might also help:

  3. #3
    Mentor coltrane's Avatar
    Join Date
    May 2001
    North Carolina

    Re: KSH prompt help!

    good link

  4. #4

    Re: KSH prompt help!

    Out of curiosity, what OS exactly are you running?

  5. #5

    Re: KSH prompt help!

    Solaris. I got it fixed though... there are some things that Bash has as system variables, that other shells don't.... but like I said, it's all working.

Similar Threads

  1. Prompt pimpin
    By jro in forum Linux - General Topics
    Replies: 6
    Last Post: 02-22-2006, 12:21 AM
  2. Colored prompt
    By postlogic in forum General Chat
    Replies: 2
    Last Post: 01-20-2005, 09:58 PM
  3. different console in non-X command prompt
    By Blaqb0x in forum Linux - General Topics
    Replies: 2
    Last Post: 06-24-2003, 03:46 PM
  4. csh: $cwd in prompt= not updating
    By Blaqb0x in forum Linux - Software, Applications & Programming
    Replies: 6
    Last Post: 02-11-2003, 04:13 AM
  5. boot prompt
    By vikram_nanda in forum Linux - Software, Applications & Programming
    Replies: 5
    Last Post: 09-10-2001, 12:54 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts