What's your $PS1?
What's your $PS1?
Other urls found in this thread:
PS1='\t \e[0;35m\u\e[m@\h \W \$ '
%B%F{red}%n%B%F{blue}:%B%F{red}%m%k%B%F{blue}%0~%b%f%k$
(for zsh)
>terminal on windows
>windows
might as well set yourself on fire
> ~$
That fat one with composite output
Different for regular user, sudo -s, sudo -i, and screen.
Not sure it that's the best way to construct the conditional if for screen, but it works.
Even a custom PS2 and 4 for shits and giggles.
if [[ ${EUID} == 0 ]] ; then
PS1='\[$(tput bold)$(tput setaf 3)\]\!:\[$(tput setaf 1)\]\u@\w:\$ \[$(tput sgr0)\]'
else
PS1='\[$(tput bold)$(tput setaf 3)\]\!:\[$(tput setaf 6)\]\u@\w:\$ \[$(tput sgr0)\]'
fi
if [ ! -z $STY ] #if GNU screen
then
PS1='\[$(tput bold)$(tput setaf 3)\]\!:\[$(tput setaf 7)\]\u@\w:\$ \[$(tput sgr0)\]'
fi
#
## PS1 in case of su root/sudo -i, paste following line (uncommented) into /root dotfile
# PS1='\[$(tput bold)$(tput setaf 3)\]\!:\[$(tput smul)$(tput setaf 1)\]\u@\w:\$\[$(tput rmul)$(tput sgr0)\] '
export PS2='\[$(tput bold)$(tput setaf 3)\]>\[$(tput sgr0)\]'
export PS4='\[$(tput rev)$(tput setaf 2)\]+\[$(tput sgr0)\] '
#
PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
# Set PS variables for use by 'update_ps1'
if [[ $EUID -eq 0 ]]
then
PS_START="\\[\\033[01;31m\\][\\h \\[\\033[01;36m\\]\\W\\[\\033[01;31m\\]]\\[\\033[0m\\]"
PS_SYMBOL="#"
else
PS_START="[\\u@\\h \\[\\033[38;5;81m\\]\\W\\[\\033[0m\\]]"
PS_SYMBOL="$"
fi
# (disable not following other people's code)
# shellcheck disable=SC1091
source /usr/share/git/git-prompt.sh
function update_ps1 {
# get the last command's exit status, then color symbol
# blue if exit code was 0, red if not
# (disable "Check exit code directly" because we are checking the last user executed exit code)
# shellcheck disable=SC2181
if [[ $? -eq 0 ]]
then
local symbol="\\[\\033[1;38;5;81m\\]${PS_SYMBOL:-%}\\[\\033[0m\\]"
else
local symbol="\\[\\033[1;38;5;09m\\]${PS_SYMBOL:-%}\\[\\033[0m\\]"
fi
__git_ps1 "${PS_START:-}" "$symbol " "(%s)"
}
# My own Prompt Strings
export PS2=$' ${LINENO: -1}>\t'
export PS3=$' >#\n'
yall aren't even trying
oh and
PROMPT_COMMAND='update_ps1'
been messing around with bash/prompt since this thread popped up
how do I make vi-mode ins/cmd appear at end of line instead of the beginning
PS1="\[\033[01;34m\]\w\[\033[00m\]$ "
set show-mode-in-prompt On
set vi-ins-mode-string (ins)
set vi-cmd-mode-string (cmd)
right now it is
(ins) ~$
I want
~$ (ins)
You can't, I checked the source code and it's hard coded to display at the beginning of the last line of a prompt, your best bet is a fork like this one
github.com
frick
>PS1
uhhhhhhhhhhhhhhhhhhhhhh
>his username is lnxuser
#####################################################
# Prompt
#####################################################
function color_my_prompt {
# PS1='\[\033[1m\033[32m\]\u@\h \w\[\033[0m\]\$ ' # original PS1
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
local __color="\[\033[01;31m\]" # red
else
local __color="\[\033[01;32m\]" # green
fi
if [ `whoami` == 'root' ]; then
local __user_and_host="# \u@\h"
else
local __user_and_host="$ \h"
fi
local __cur_location="\[\033[01;34m\]\w"
local __git_branch_color="\[\033[31m\]"
local __git_branch='`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`'
local __last_color="\[\033[00m\]"
export PS1="$__color$__user_and_host $__cur_location $__git_branch_color$__git_branch$__prompt_tail$__last_color> "
}
color_my_prompt
This one changes color when logging in via SSH, to avoid making the mistake of running the command on the wrong box when you have many tmux panes open
Anything more is useless.
PS1="
\$PWD
"
%(?.%K{white}%F{black}.%K{red}%F{white}) %~ %k%f %F{red}%B >%b%f
On ZSH
just do /w, it's pwd but turns /home/user/ into ~
In before some nigger posts a picture of the first video game console by Sony
PS1: %K{black}%(?,%F{2},%F{9}) %F{blue}%K{blue}%(!,%F{yellow} %f,)%F{black}%k%F{blue}%f
RPS1:
PS2: %K{black}%F{yellow} %K{blue} %k%f
RPS2:
PS3: %F{blue}%K{black} %k%F{blue}%f
RPS3: \sPS4: %F{yellow}%K{black}% :%i %F{12}|%F{yellow} ev:%e %F{12}|%F{yellow} %N %F{12}%F{yellow} %_ %F{12}%f%k
bretty gud
What's the + for? regular user?
thats the ps2
fuck, totally missed that dude.
oh.my.zsh theme agnoster, reversed so the lettering is white (doesn't detect my dark terminal by default). Or maybe that was the default and i just switched it back.
case "${TERM}" in
[aEkx]term*|rxvt*|gnome*|konsole*|interix|st-256color)
function change_title() {
printf "\033]0;%s@%s:%s\007" \
${USER} ${HOSTNAME:=$(hostname)} ${PWD/$HOME/\~}
}
;;
screen*)
function change_title() {
printf "\033k%s@%s:%s\033\\" \
${USER} ${HOSTNAME:=$(hostname)} ${PWD/$HOME/\~}
}
;;
*)
function change_title() {
return
}
esac
function home() {
local WD=${PWD/$HOME/\~}
if (( ${#WD} > 23 )); then
print -n ${WD:0:10}...${WD: -10: -1} '';
else
print -n $WD '';
fi
}
function git_branch() {
git branch 2>/dev/null | awk '/\*/{ printf("%s ", $0) }'
}
function final_char() {
if (( USER_ID ))
then print -n \$ ''
else print -n \# ''
fi
}
PS1=$'\e[32;2m$(change_title)$(home)$(git_branch)\e[0m$(final_char)'
4.4 Wed Aug 29 jason@Yog-Sothoth 0: $
read it and weep new fags:
PS1="\n\[\e[1;30m\][$$:$PPID - \j:\!\[\e[1;30m\]]\[\e[0;36m\] \T \[\e[1;30m\][\[\e[1;34m\]\u@\H\[\e[1;30m\]:\[\e[0;37m\]${SSH_TTY:-o} \[\e[0;32m\]+${SHLVL}\[\e[1;30m\]] \[\e[1;37m\]\w\[\e[0;37m\] \n\$"
Just ">" because I'm a chad who can remember things.