LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   *BSD (https://www.linuxquestions.org/questions/%2Absd-17/)
-   -   post your custom command prompts thread. (https://www.linuxquestions.org/questions/%2Absd-17/post-your-custom-command-prompts-thread-4175621255/)

////// 01-09-2018 02:59 AM

post your custom command prompts thread.
 
1 Attachment(s)
couldnt find thread like this, so i decided to post one here.
post your pretty colored or not command prompts.

mine is for ksh on openbsd 6.1 amd64
Code:

export PS1="\033[32m\u@\h\033[00m:\033[36m$\w\033[00m# "
and it looks like this :

MensaWater 01-09-2018 08:41 AM

I pretty much use the default these days.

Your post reminded about a time I did change the prompt on DOS. A coworker and I were talking about our relative computer skills and he said there was nothing I could do that he couldn't. When he left work I changed his DOS prompt to:
Barry can't find me>

I did that by creating a bat file named c1s.bat then adding c1s to his autoexec.bat. In those days almost all autoexec.bat files had "cls" in them. (Note the middle character in the bat I created was numeral "1" where as the clear screen command's middle character is letter "l".)

The next day he came into work and tried multiple things to get rid of this prompt all to no avail. I finally stopped him and told him what I'd done when he got to the point of reinstalling the OS. :D

////// 01-09-2018 09:13 AM

i actually did create dos command prompt on my fathers 286, (i was 10+ years old then) your post reminded me about that :D

i like fiddling with things like command prompts etc.

cynwulf 01-09-2018 03:27 PM

In ~/.profile (for login shells)
Code:

PS1="\u@\h:\w $ "
Gives e.g.
Code:

user@hostname:/usr/src $

ondoho 01-11-2018 03:34 AM

1 Attachment(s)
I've had this in my /etc/bash.bashrc for a long while now:
Code:

        if [[ ${EUID} == 0 ]] ; then
                color=1 # red
        else
                color=2 # green
        fi
        if [ "$TERM" != "linux" ]; then
                PS1="\[$(tput setaf $color)\]\[$(tput rev)\]  \[$(tput sgr0)\]\[$(tput setaf 5)\]\${?#0}\[$(tput setaf $color)\] \u@\h \w\[$(tput sgr0)\]\n\[$(tput rev)\]  \[$(tput sgr0)\] "
        else
                # adding \t = time to tty prompt
                PS1="\[$(tput setaf $color)\]\[$(tput rev)\]  \[$(tput sgr0)\]\[$(tput setaf 5)\]\${?#0}\[$(tput setaf $color)\] \t \u@\h \w\[$(tput sgr0)\]\n\[$(tput rev)\]  \[$(tput sgr0)\] "
        fi
        unset color


////// 01-11-2018 07:08 AM

1 Attachment(s)
thats vnice looking, clean compared to mine :

Code:

export PS1="\[\033[1;34m\][\$(date +%H:%M)][\[\033[1;31m\]\u\[\033[1;32m\]@\h:\[\033[1;34m\]\w]#\[\033[0m\] "

ondoho 01-11-2018 12:56 PM

1 Attachment(s)
i forgot to mention a neat feature:
it also shows the return value of the last command, if it's larger than 0:

cynwulf 01-11-2018 04:43 PM

DragonFly BSD 5.0.2

~/.cshrc (tcsh prompt)
Code:

set prompt = "%N@%m:%~ %# "
The result is much the same as my OpenBSD 6.2 ksh prompt (posted above))
Code:

user@hostname:~ %
No fancy colours though...


All times are GMT -5. The time now is 02:50 PM.