[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Pimp your shell - Debian developer tips?



On Jo, 04 iun 20, 10:13:06, Michael Shuler wrote:
> On 6/3/20 7:30 PM, Gunnar Wolf wrote:
> > Like Paul said in his reply, I also have a "bash monstrosity" as a
> > Bash prompt.
> 
> For many years, I have taken a different approach; use the default and add
> only a few minor changes. Each stable update, I use /etc/skel/.bashrc and
> edit/add in my little bits.

+1

While not a developer I'll dare share some my changes as well.


At least 'linux' and 'screen' should be added to /etc/skel/.bashrc


# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
    rxvt*) color_prompt=yes;;
    linux) color_prompt=yes;;
    screen*) color_prompt=yes;;
esac


Let's use packages in the distribution whenever possible ;)
I don't recall where I got the prompt command from...


# add git branch information to avoid commiting to 'master' by mistake
if [[ -e /usr/lib/git-core/git-sh-prompt ]]; then
        . /usr/lib/git-core/git-sh-prompt
fi
GIT_PS1_SHOWUPSTREAM="verbose"
#PROMPT_COMMAND='__git_ps1 "${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00;32m\]" "\[\033[00m\]\n└─> \$ "'
PROMPT_COMMAND='__git_ps1 "${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00;32m\]" "\[\033[00m\]\$ "'


BTW, I prefer 'W' to 'w' (it's my only change below) :)


if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt


'--human-readable' makes for a nicer 'ls -l' in the age of MiB, GiB 
files.

Maybe grep --color should be enabled by default as well?


# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto --human-readable'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    #alias fgrep='fgrep --color=auto'
    #alias egrep='egrep --color=auto'
fi



Hope this is useful to someone,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser

Attachment: signature.asc
Description: PGP signature


Reply to: