From 9fb98105c01a1e6c727570f1e8ae2278be247066 Mon Sep 17 00:00:00 2001 From: pvincent Date: Mon, 17 Nov 2025 20:52:12 +0400 Subject: [PATCH] realpath MIAOU_BASH_DIR + hostname -f in prompt --- bash.bashrc | 10 ++++++---- init.sh | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bash.bashrc b/bash.bashrc index 92d6370..39ac40f 100644 --- a/bash.bashrc +++ b/bash.bashrc @@ -59,7 +59,7 @@ function __prompt_command { PS1+="${R}" ;; esac - PS1+="\h" + PS1+="$HOSTNAME" local pwd='~' [ "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/} @@ -155,6 +155,11 @@ case $- in *) return ;; esac +MIAOU_BASH_DIR=$(realpath /opt/miaou-bash) +export MIAOU_BASH_DIR + +HOSTNAME=$(hostname -f) + # don't put duplicate lines or lines starting with space in the history. HISTCONTROL=ignoreboth @@ -199,8 +204,6 @@ stty -ixon PROMPT_COMMAND='__prompt_command' # Func to gen PS1 after CMDs -MIAOU_BASH_DIR=/opt/miaou-bash - # ALIASES alias sudo='sudo ' # smart sudo alias trick! @@ -235,4 +238,3 @@ alias ssu4="ss -ntel4p | perl -pne 'if(/uid:(\\d+)/){@a=getpwuid(\$1);s/uid:(\\d # Add path to any tools folder in /opt/miaou-* for i in {/opt,$HOME}/miaou-*/tools; do [[ -d "$i" ]] && PATH=$PATH:$i; done || true - diff --git a/init.sh b/init.sh index 7456843..563a503 100755 --- a/init.sh +++ b/init.sh @@ -4,7 +4,7 @@ set -Eeuo pipefail [ "$(id -u)" -ne 0 ] && echo 'root privilege required' && exit 1 -readonly MIAOU_BASH_DIR='/opt/miaou-bash' +readonly OPT_MIAOU_DIR='/opt/miaou-bash' #remove /etc/skel/.bashrc if [ -e /etc/skel/.bashrc ]; then @@ -18,6 +18,6 @@ for i in "${arr[@]}"; do if [[ -f "$i" ]] && [[ ! -f "$i.$ORIGINAL" ]]; then mv "$i" "$i.$ORIGINAL" basefile=$(basename "$i") - ln -s "$MIAOU_BASH_DIR/$basefile" "$i" + ln -s "$OPT_MIAOU_DIR/$basefile" "$i" fi done