From 1d77beae7391551efd200bf0a7529168c4e6c74b Mon Sep 17 00:00:00 2001 From: Patrick Verschuer Date: Tue, 10 Feb 2026 17:45:43 +0100 Subject: [PATCH] Inital commit --- default.rc | 10 ++++++++++ lib/bash_history | 4 ++++ lib/general | 3 +++ lib/root | 13 +++++++++++++ lib/source_colors | 13 +++++++++++++ 5 files changed, 43 insertions(+) create mode 100644 default.rc create mode 100644 lib/bash_history create mode 100644 lib/general create mode 100644 lib/root create mode 100644 lib/source_colors diff --git a/default.rc b/default.rc new file mode 100644 index 0000000..87025d0 --- /dev/null +++ b/default.rc @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +WHEREAMI="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )"; +WHOIAM="${WHEREAMI}/$(basename -- "${BASH_SOURCE[0]:-$0}"; )" + +. ${WHEREAMI}/lib/general +. ${WHEREAMI}/lib/proxy_onprem +. ${WHEREAMI}/lib/source_colors +. ${WHEREAMI}/lib/bash_history +. ${WHEREAMI}/lib/root diff --git a/lib/bash_history b/lib/bash_history new file mode 100644 index 0000000..261dfe2 --- /dev/null +++ b/lib/bash_history @@ -0,0 +1,4 @@ +export HISTTIMEFORMAT='%Y_%m_%d %H:%M:%S ' +export HISTFILESIZE='big' +export HISTSIZE='big' +export HISTFILE=~/.bash_history_patrick diff --git a/lib/general b/lib/general new file mode 100644 index 0000000..5856197 --- /dev/null +++ b/lib/general @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +export PROMPT_COMMAND="history -a" diff --git a/lib/root b/lib/root new file mode 100644 index 0000000..0caef51 --- /dev/null +++ b/lib/root @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +rsudo () { + . /etc/os-release + + RHEL_MAJOR_VERSION=$(echo "$VERSION_ID" | cut -d'.' -f1) + + if [ "$RHEL_MAJOR_VERSION" -eq 7 ]; then + sudo -i /bin/bash -c ". ${WHOIAM}; exec bash" + else + sudo machinectl shell root@.host /bin/bash -c ". /etc/profile; . ${WHOIAM}; exec bash" + fi +} diff --git a/lib/source_colors b/lib/source_colors new file mode 100644 index 0000000..ba1d53f --- /dev/null +++ b/lib/source_colors @@ -0,0 +1,13 @@ +#!/bin/bash + +if [[ $- == *i* ]]; then + COLOR_RESET="\\[$(tput sgr0)\\]" + COLOR_BLACK="\\[$(tput setaf 0)\\]" + COLOR_RED="\\[$(tput setaf 1)\\]" + COLOR_GREEN="\\[$(tput setaf 2)\\]" + COLOR_YELLOW="\\[$(tput setaf 3)\\]" + COLOR_BLUE="\\[$(tput setaf 4)\\]" + COLOR_MAGENTA="\\[$(tput setaf 5)\\]" + COLOR_CYAN="\\[$(tput setaf 6)\\]" + COLOR_WHITE="\\[$(tput setaf 7)\\]" +fi