Compare commits

...

10 Commits

Author SHA1 Message Date
b551e74961 bashrc.cust: Show full host name 2024-08-12 19:09:27 +02:00
1d34037dff bashrc: Merge-in new system file 2024-07-25 11:00:12 +02:00
76c0e2c82c bashrc: Update interactive shell detection condition
Bash manual defines a shell as interactive if "$PS1" is set, there's no need to check it against a specific string.
2024-02-24 16:28:19 +01:00
0130317102 bashrc.cust: Update 'ls' aliases 2023-01-01 00:05:14 +01:00
5b08dd1e63 bashrc: Merge-in new system file 2022-08-16 14:18:25 +02:00
555f3c5ea8 bashrc: Merge-in new system file 2022-05-28 17:50:18 +02:00
dc208ab453 bashrc.cust: Add 'man' alias
Use 'bat' as pager for manuals.
2021-08-11 15:24:40 +02:00
4fd2169d0d bashrc.cust: Add 'findstring' function 2021-08-11 15:13:49 +02:00
d5f85a724c bashrc.cust: Set custom history control
* ignoredups: ignore duplicate commands
* ignorespace: ignore commands beginning with a space
2021-08-11 15:12:59 +02:00
b1dd14fa7b bashrc.cust: Add 'getalias' function 2021-08-11 14:52:05 +02:00
2 changed files with 19 additions and 17 deletions

20
bashrc
View File

@@ -15,12 +15,11 @@ if [ -z "$BASHRCSOURCED" ]; then
# are we an interactive shell?
if [ "$PS1" ]; then
if [ -z "$PROMPT_COMMAND" ]; then
declare -a PROMPT_COMMAND
case $TERM in
xterm*|vte*)
xterm*)
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
elif [ "${VTE_VERSION:-0}" -ge 3405 ]; then
PROMPT_COMMAND="__vte_prompt_command"
else
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
fi
@@ -39,9 +38,9 @@ if [ -z "$BASHRCSOURCED" ]; then
fi
# Turn on parallel history
shopt -s histappend
history -a
# Turn on checkwinsize
shopt -s checkwinsize
# Change the default prompt string
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
# You might want to have e.g. tty in prompt (e.g. more virtual machines)
# and console windows
@@ -67,15 +66,8 @@ if [ -z "$BASHRCSOURCED" ]; then
esac
}
# By default, we want umask to get set. This sets it for non-login shell.
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
umask 002
else
umask 022
fi
# Set default umask for non-login shell only if it is set to 0
[ `umask` -eq 0 ] && umask 022
SHELL=/bin/bash
# Only display echos from profile.d scripts if we are no login shell
@@ -100,6 +92,6 @@ fi
# Include customized configurations for interactive shell
if [ "$PS1" = "[\u@\h \W]\\$ " ]; then
if [ "$PS1" ]; then
source /etc/bashrc.cust
fi

View File

@@ -1,7 +1,7 @@
# Custom configuration file
# Prompt configuration
PS1="\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"(\[\033[0;31m\]\342\234\227\[\033[0;31m\])\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root'; else echo '\[\033[0;39m\]\u'; fi)\[\033[01;33m\]@\[\033[01;96m\]\h\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]\\$\[\e[0m\]"
PS1="\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"(\[\033[0;31m\]\342\234\227\[\033[0;31m\])\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root'; else echo '\[\033[0;39m\]\u'; fi)\[\033[01;33m\]@\[\033[01;96m\]\H\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]\\$\[\e[0m\]"
# Attibutes
@@ -11,6 +11,7 @@ shopt -s checkjobs
# Variables
export HISTCONTROL="ignoredups:ignorespace"
export LESSHISTFILE=-
@@ -19,8 +20,9 @@ alias c='bat -n'
alias dd='dd status=progress'
alias e='nano'
alias grep='grep --color=auto -i'
alias l='ls'
alias la='ls -A'
alias l='ls --group-directories-first'
alias la='ls -A --group-directories-first'
alias man='man -P "bat -p -l man"'
alias o='xdg-open'
alias r='rm -fr'
alias repoinit='repo init --no-clone-bundle'
@@ -34,3 +36,11 @@ function cust-error {
echo "ERROR: Invalid argument(s)!"
exit 1
}
function findstring {
find . -type f -exec grep --color=auto -i "$@" "{}" +
}
function getalias {
alias "$1" |cut -d "=" -f 2- |sed "s/.//; s/.$//"
}