From 53b55b4b10ef6344a882402d5dcaf11d87b78d3f Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Sat, 19 Mar 2022 19:27:36 +0100 Subject: Initial commit --- .bash/vars.bash | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .bash/vars.bash (limited to '.bash/vars.bash') diff --git a/.bash/vars.bash b/.bash/vars.bash new file mode 100644 index 0000000..dddc831 --- /dev/null +++ b/.bash/vars.bash @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +# vim:syntax=sh + +# default Byobu session name +export BSNAME="CHANGEME" +# default screenshot target. Feel free to override in .local. +export SCRSHDIR="${HOME}/Pictures" +# variable for SSH environment file +export SSHENVFILE="${HOME}/.ssh/sshenv" + +# ----- SHELL ----- # +for pa in "/usr/local/bin" "${HOME}/bin";do + if ! printf "%b" "$PATH"|grep -P "^${pa}:|:${pa}:" >/dev/null;then + export PATH="${pa}:${PATH}" + fi +done +# $OSNAME +if [ -r "/etc/os-release" ];then + OSNAME="$(grep ^ID /etc/os-release|awk -F= '{print $NF}'|head -n1)" +elif [ -r "/etc/redhat-release" ];then + grep -P "^Red[\ ]?[Hh]at" /etc/redhat-release >/dev/null 2>&1 && OSNAME="redhat" + grep -P "^[Ff]edora" /etc/redhat-release >/dev/null 2>&1 && OSNAME="fedora" + grep -P "^[Cc]ent[Oo][Ss]" /etc/redhat-release >/dev/null 2>&1 && OSNAME="centos" + [ -z "$OSNAME" ]&&OSNAME="obsolete" +elif [ -r "/etc/SuSE-release" ];then + OSNAME="oldsuse" +elif [ -r "/etc/release" ];then + head -n1 /etc/release 2> /dev/null|grep -i solaris > /dev/null && OSNAME="solaris" + [ -z "$OSNAME" ]&&OSNAME="obsolete" +else + [ "$(oslevel -s >/dev/null 2>&1|wc -l)" -gt 0 ]&&OSNAME="aix" + [ -z "$OSNAME" ]&&OSNAME="obsolete" +fi +declare -x GPG_TTY +GPG_TTY="$(tty)" +export e='2.718281828459045' +if command -v bc >/dev/null;then + declare -x pi + pi="$(echo "scale=64; 4*a(1)" | bc -l)" +fi + +# ----- GIT ----- # +# git on the command line +export GIT_PS1_SHOWDIRTYSTATE=1 +export GIT_PS1_SHOWSTASHSTATE=1 +export GIT_PS1_SHOWUNTRACKEDFILES=1 + +# ----- LESS FOR EVERYTHING ----- # +if command -v less >/dev/null;then + # coloured mapages + export LESS_TERMCAP_mb=$'\E[01;31m' + export LESS_TERMCAP_md=$'\E[01;31m' + export LESS_TERMCAP_me=$'\E[0m' + export LESS_TERMCAP_se=$'\E[0m' + export LESS_TERMCAP_so=$'\E[01;44;33m' + export LESS_TERMCAP_ue=$'\E[0m' + export LESS_TERMCAP_us=$'\E[01;32m' + # make less more friendly for non-text input files, see lesspipe(1) + [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)" + export SYSTEMD_PAGER="less" + export LESSANSIENDCHARS="m" + export LESSANSIMIDCHARS="0123456789:;[?!\"'#%()*+ " +fi +# ----- MISC ----- # +# nopaste +export NOPASTE_SERVICES='pastebin nopaste' +export NOPASTE_NICK='CHANGEME' +# libvirt +export LIBVIRT_DEFAULT_URI="qemu:///system" +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi -- cgit v1.2.3