From 4f38a244158ce26da0c7d683e10ea405046d243e Mon Sep 17 00:00:00 2001 From: Christoph Date: Fri, 25 Sep 2020 17:50:02 +0200 Subject: [PATCH] add_new_user.sh: update template '.bashrc' --- supported-files/user_templates/all/.bashrc | 33 ++++++++++++++++------ 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/supported-files/user_templates/all/.bashrc b/supported-files/user_templates/all/.bashrc index af95690..080da51 100644 --- a/supported-files/user_templates/all/.bashrc +++ b/supported-files/user_templates/all/.bashrc @@ -3,23 +3,30 @@ # for examples # If not running interactively, don't do anything -[ -z "$PS1" ] && return +case $- in + *i*) ;; + *) return;; +esac -# don't put duplicate lines in the history. See bash(1) for more options -# don't overwrite GNU Midnight Commander's setting of `ignorespace'. -HISTCONTROL=$HISTCONTROL${HISTCONTROL+:}ignoredups -# ... or force ignoredups and ignorespace +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options HISTCONTROL=ignoreboth # append to the history file, don't overwrite it shopt -s histappend # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + # make less more friendly for non-text input files, see lesspipe(1) #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" @@ -48,11 +55,15 @@ if [ -n "$force_color_prompt" ]; then color_prompt= fi fi - +__hostname="$(hostname -f)" +__hostname="${__hostname%.*}" +__hostname="${__hostname%.*}" if [ "$color_prompt" = yes ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' + #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@${__hostname}:\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else - PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' + #PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' + PS1='${debian_chroot:+($debian_chroot)}\u@${__hostname}:\w\$ ' fi unset color_prompt force_color_prompt @@ -98,8 +109,12 @@ fi # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). -if [ -f /etc/bash_completion ] && ! shopt -oq posix; then +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then . /etc/bash_completion + fi fi export EDITOR=vim