Portál AbcLinuxu, 30. dubna 2025 21:24
pwd
function smail { if [ $? = 0 ]; then echo -ne '\033[00;32m:)\033[01;34m' else echo -ne '\033[01;31m:(\033[01;34m' fi } if [[ ${EUID} == 0 ]] ; then PS1='`smail` \[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] ' else PS1='`smail` \[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' firulez
$()
cili zase se pousti dalsi shell a tomu je IMO lepe se vyhnout
$ cat /etc/profile.d/prompt.sh #!/bin/bash bash_prompt_command() { local LAST=$? if [ ${LAST} -eq 0 ]; then LAST='' else LAST="[\[\033[1;31m\]${LAST}\[\033[0m\]\[\033[1;30m\]]" fi local TIME=`date +%H:%M` local pwdmaxlen=20 local trunc_symbol="..." local dir=${PWD##*/} pwdmaxlen=$(( ( pwdmaxlen < ${#dir} ) ? ${#dir} : pwdmaxlen )) local SHORT_PWD=${PWD/#$HOME/\~} local pwdoffset=$(( ${#SHORT_PWD} - pwdmaxlen)) if [ ${pwdoffset} -gt "3" ]; then SHORT_PWD=${SHORT_PWD:$pwdoffset:$pwdmaxlen} SHORT_PWD=${trunc_symbol}/${SHORT_PWD#*/} fi if [ "$TERM" = "xterm" -o "$TERM" = "xterm-color" -o "$TERM" = "rxvt" -o "$TERM" = "xterm-xfree86" ]; then echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007" fi if [ "$UID" = "0" ]; then local USER_HOST="\[\033[1;31m\]\h" else local USER_HOST="\[\033[1;32m\]\u\[\033[1;34m\]@\h" fi PS1="\[\033[1;30m\][\[\033[0;35m\]${TIME}\[\033[1;30m\]][${USER_HOST} \[\033[1;33m\]${SHORT_PWD}\[\033[1;30m\]]${LAST}\\$\[\033[0m\] " } PROMPT_COMMAND=bash_prompt_commandnejlepší prompt
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.