Discussion forums for Arch Linux, a simple, lightweight linux distribution.
You are not logged in.
On my current laptop and desktop:
PS1="\$ " # User PS1="# " # Root
On my future laptop:
PS1="\[\033[1;34m\]arch\[\033[0;37m\]angel\$ " # User PS1="\[\033[1;34m\]arch\[\033[0;37m\]angel# " # Root
Last edited by Barrucadu (2008-06-26 19:13:53)
Offline
PS1='\[\e[1;35m\]\u\[\e[m\] \[\e[1;34m\]\W\[\e[m\] \[\e[1;31m\]> \[\e[0m\]'
PS2='>'
echo -e " Welcome to ${bold}Arch Linux${boldoff}"
sleep 1
clear
I like to add a little welcome message ![]()
To see what my prompt looks like, just take a look at My Desktop
Last edited by Stythys (2008-06-26 19:28:03)
Offline
zsh:
PROMPT=$'%{\e[0;31m%}[%{\e[1;32m%}%*%{\e[0;31m%}][%{\e[0;32m%}%n@%m%{\e[0;31m%}]%{\e[1;31m%}%#%{\e[0m%} '
RPROMPT=$'%{\e[0;31m%}[%{\e[1;32m%}%~%{\e[0;31m%}]%{\e[0m%}'[1:25:17][lucke@kingdom]% [~]
Offline
PS1='\n\[\033[0;32m\]\u@\h \[\033[1;33m\]\w\n\[\033[0m\]> ' PS2='\\ '
allan@arch ~ >
Offline
zsh:
PS1="%{${fg_bold[blue]}%}[%{${fg_bold[default]}%}%D%{${fg_bold[blue]}%}]-[%{${fg_bold[default]}%}%n%{${fg_bold[blue]}%}]-[${fg_bold[default]}%m%{${fg_bold[blue]}%}]-[\
%{${fg_bold[default]}%}${$(tty)#/dev/##}%}%{${fg_bold[blue]}%}]-[\
%{${fg_bold[default]}%}%~%{${fg_bold[blue]}%}]
[%{${fg_bold[default]}%}%*%{${fg_bold[blue]}%}]-%#%{${fg_bold[default]}%} "[08-06-27]-[chi]-[tatooine]-[pts/1]-[~] [1:34:59]-%
Last edited by chimeric (2008-06-26 19:38:59)
Offline
user "> "
root "# "
Offline
if [ `id -u` != "0" ]; then
PS1="${TITLEBAR}${GREEN}\u${CYAN}@${BRIGHTGREEN}\h ${CYAN}\w${WHITE} ${default}$ "
else
PS1="${TITLEBAR}${RED}\u${CYAN}@${BRIGHTGREEN}\h ${CYAN}\w${WHITE} ${default}$ "
fiedit: Where does the "#" for root come from?
Last edited by Purch (2008-06-27 01:38:14)
Offline
bash_prompt_cmd() {
local CY="\[\e[1;36m\]" # Each is 12 chars long
local BL="\[\e[1;34m\]"
local WH="\[\e[1;37m\]"
local BR="\[\e[0;33m\]"
local RE="\[\e[1;31m\]"
local PROMPT="${CY}$"
[ $UID -eq "0" ] && PROMPT="${RE}#"
# Add the first part of the prompt: username,host, and time
local PROMPT_PWD=""
local PS1_T1="$BL.:[ $CY`whoami`@`hostname` $BL: $CY\t $BL:$CY "
local ps_len=$(( ${#PS1_T1} - 12 * 6 + 6 + 4 )) #Len adjust for colors, time and var
local PS1_T2=" $BL]:.\n${PROMPT} \[\e[0m\]"
local startpos=""
PROMPT_PWD="${PWD/#$HOME/~}"
local overflow_prefix="..."
local pwdlen=${#PROMPT_PWD}
local maxpwdlen=$(( COLUMNS - ps_len ))
# Sometimes COLUMNS isn't initiliased, if it isn't, fall back on 80
[ $maxpwdlen -lt 0 ] && maxpwdlen=$(( 80 - ps_len ))
if [ $pwdlen -gt $maxpwdlen ] ; then
startpos=$(( $pwdlen - maxpwdlen + ${#overflow_prefix} ))
PROMPT_PWD="${overflow_prefix}${PROMPT_PWD:$startpos:$maxpwdlen}"
fi
export PS1="${PS1_T1}${PROMPT_PWD}${PS1_T2}"
}
PROMPT_COMMAND=bash_prompt_cmdIn effect, it looks like:
.:[ b-con@beacon : the-time : /working/directory ]:. $
with colorization. I pieced it together so that I could dynamically calculate the width of the terminal and truncate the displayed working directory if it causes the total width of the line to exceed the terminal's width. (Given how I do things, this actually comes in handy every now and then.)
Last edited by B-Con (2008-06-27 04:02:19)
Offline
Purch wrote:
Code:
if [ `id -u` != "0" ]; then PS1="${TITLEBAR}${GREEN}\u${CYAN}@${BRIGHTGREEN}\h ${CYAN}\w${WHITE} ${default}$ " else PS1="${TITLEBAR}${RED}\u${CYAN}@${BRIGHTGREEN}\h ${CYAN}\w${WHITE} ${default}$ " fiedit: Where does the "#" for root come from?
Online
Guys, ah, may I ask what this is all about...? ![]()
Offline
Yes, you may ask. Would you like an answer to go with your question?
Well, PS1 is a variable set in your .bashrc that defines what your prompt looks like.
Offline
function precmd {
export PS1="%m@%(!.%{${RED}%}%n.%{${GREEN}%}%n)% %{${WHITE}%}% %{${WHITE}%}%~ %#"
}
export RPS1="%(?..%?)"
export SPROMPT='%R is not available, maybe you fool wanted %r? '
export PS2='`_> '
preexec () {
if [[ "$TERM" == "screen" ]]; then
local CMD=${1[(wr)^(*=*|sudo|-*)]}
echo -ne "\ek$CMD\e\\"
fi
}
SELECTMIN=5gives
moose@hrist~ %
hrist is green the rest is white
and I don't know why the picture isn't shown ![]()
Last edited by hrist (2008-06-27 10:24:29)
Offline
PS1='\[\033[0;31m\][\@]\[\033[0;m\][\[\033[0;34m\]\u@\[\033[0;33m\]\h\[\033[0;m\] \w]\[\033[0;32m\]\$ '
set prompt="%{^[[31m%}[%t]%{^[[m%}[%{^[[34m%}%n@%{^[[33m%}%m %{^[[m%}%~]%{^[[32m%}$ "
First is for bash, the second is for tcsh. They are the same, took me ages to do!
Offline
mine is very simple, but i do have a problem with text overflow going over what i had typed. if i could get some help with that ?
in .bashrc :
export PS1='\[\e]2; \d, \@ | Arch64\a\]\u \w $ '
Offline
PS1='\[\e[0;36m\]\h\[\e[m\]-\[\e[0;37m\]\u\[\e[m\]\[\e[0;37m\] \w:
> '
Is mine
Offline
export PS1=$'%{\e[0;36m%}%?%.%#%{\e[0;0m%}'
export PS2=$'%{\e[0;36m%}%?%.%{\e[0;0m%}> 'For zsh. It looks awful, but it's really just the return value of the last command, the current directory (sans path), and a %, all in cyan.
Offline
This is what i used to have:
green smile when command is succesful and a red frown when it fails
bash_prompt_command() {
RTN=$?
smiley=$(smiley $RTN)
smileyc=$(smileyc $RTN)
}
PROMPT_COMMAND=bash_prompt_command
smiley() {
if [ $1 == 0 ] ; then
echo ":)"
else
echo ":("
fi
}
smileyc() {
if [ $1 == 0 ] ; then
echo $GREEN
else
echo $RED
fi
}
if [ $(tput colors) -gt 0 ] ; then
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
RST=$(tput op)
fi
PS1="\[\$smileyc\]\$smiley\[$RST\] \$ "but now i've combined it (see: hacked it together) with B-con's lovley script:\
bash_prompt_cmd() {
RTN=$?
smiley() {
if [ $1 == 0 ] ; then
echo ":)"
else
echo ":("
fi
}
smileyc() {
if [ $1 == 0 ] ; then
echo $GREEN
else
echo $RED
fi
}
if [ $(tput colors) -gt 0 ] ; then
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
RST=$(tput op)
fi
smiley=$(smiley $RTN)
smileyc=$(smileyc $RTN)
local CY="\[\e[1;31m\]" # Each is 12 chars long
local BL="\[\e[1;34m\]"
local WH="\[\e[1;37m\]"
local BR="\[\e[0;33m\]"
local RE="\[\e[1;31m\]"
local PROMPT="${CY}$"
[ $UID -eq "0" ] && PROMPT="${RE}#"
# Add the first part of the prompt: username,host, and time
local PROMPT_PWD=""
local PS1_T1="$BL.:[ $CY`whoami`@`hostname` $BL: $CY\t $BL:$CY "
local ps_len=$(( ${#PS1_T1} - 12 * 6 + 6 + 4 )) #Len adjust for colors, time and var
local PS1_T2=" $BL]:.\n\[\$smileyc\]\$smiley\[$RST\] "
local startpos=""
PROMPT_PWD="${PWD/#$HOME/~}"
local overflow_prefix="..."
local pwdlen=${#PROMPT_PWD}
local maxpwdlen=$(( COLUMNS - ps_len ))
# Sometimes COLUMNS isn't initiliased, if it isn't, fall back on 80
[ $maxpwdlen -lt 0 ] && maxpwdlen=$(( 80 - ps_len ))
if [ $pwdlen -gt $maxpwdlen ] ; then
startpos=$(( $pwdlen - maxpwdlen + ${#overflow_prefix} ))
PROMPT_PWD="${overflow_prefix}${PROMPT_PWD:$startpos:$maxpwdlen}"
fi
export PS1="${PS1_T1}${PROMPT_PWD}${PS1_T2}"
}
PROMPT_COMMAND=bash_prompt_cmdOffline
PS1='\[\033[1;31m\]\W/\[\033[0m\] '
Simplicity.
Last edited by Square (2008-07-03 02:22:12)
Offline
user
PS1='[\[\033[1;36m\]\u\[\033[0m\]@\h \W]\$ '
root
PS1='[\[\033[1;31m\]\u\[\033[0m\]@\h \W]\$ '
Offline
\@ \[\033[0;32m\] \w\[\033[0m\] >
2:05 PM ~ >
The working directory portion is in green.
Last edited by synorgy (2008-07-03 14:13:33)
Offline
Square wrote:
Code:
PS1='\[\033[1;31m\]\W/\[\033[0m\] 'Simplicity.
What a great idea! Do I really need to see the full path of every directory I'm in? ...No...
Offline