Files
webmin/xterm/rc/.bashrc
Ilia Ross 7e01b3eb44
Some checks failed
webmin.dev: webmin/webmin / build (push) Has been cancelled
Fix to set XDG runtime and D-Bus env in xterm shells
https://github.com/webmin/webmin/issues/2679
2026-05-05 09:41:45 +02:00

70 lines
1.8 KiB
Bash

# don't put duplicate lines in the history
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
alias ls='ls --color=auto'
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'
alias ip='ip --color=auto'
fi
# custom PS1
if [ "$(id -u)" -eq 0 ]; then
PS1='\[\033[1m\033[38;5;196m\]\u\[\033[1;39m\]@\[\033[38;5;82m\]\h:\[\033[38;5;213m\]\w\[\033[1;37m\]\$\[\033[0m\] '
else
PS1='\[\033[1m\033[38;5;208m\]\u\[\033[1;39m\]@\[\033[38;5;82m\]\h:\[\033[38;5;213m\]\w\[\033[1;37m\]\$\[\033[0m\] '
fi
# user default run time config
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# user default profile config
if [ -f ~/.bash_profile ]; then
. ~/.bash_profile
elif [ -f ~/.profile ]; then
. ~/.profile
fi
# user specific aliases and functions
if [ -d ~/.bashrc.d ]; then
for rc in ~/.bashrc.d/*; do
if [ -f "$rc" ]; then
. "$rc"
fi
done
fi
unset rc
# set XDG_RUNTIME_DIR and DBUS_SESSION_BUS_ADDRESS if not set
if [ -z "$XDG_RUNTIME_DIR" ]; then
uid=$(id -u)
xdg_runtime_dir="/run/user/$uid"
if [ -d "$xdg_runtime_dir" ] && [ -O "$xdg_runtime_dir" ] && \
[ -S "$xdg_runtime_dir/bus" ]; then
export XDG_RUNTIME_DIR="$xdg_runtime_dir"
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
fi
unset uid xdg_runtime_dir
fi