Browse Source

realpath MIAOU_BASH_DIR + hostname -f in prompt

main
pvincent 6 days ago
parent
commit
9fb98105c0
  1. 10
      bash.bashrc
  2. 4
      init.sh

10
bash.bashrc

@ -59,7 +59,7 @@ function __prompt_command {
PS1+="${R}" PS1+="${R}"
;; ;;
esac esac
PS1+="\h"
PS1+="$HOSTNAME"
local pwd='~' local pwd='~'
[ "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/} [ "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/}
@ -155,6 +155,11 @@ case $- in
*) return ;; *) return ;;
esac 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. # don't put duplicate lines or lines starting with space in the history.
HISTCONTROL=ignoreboth HISTCONTROL=ignoreboth
@ -199,8 +204,6 @@ stty -ixon
PROMPT_COMMAND='__prompt_command' # Func to gen PS1 after CMDs PROMPT_COMMAND='__prompt_command' # Func to gen PS1 after CMDs
MIAOU_BASH_DIR=/opt/miaou-bash
# ALIASES # ALIASES
alias sudo='sudo ' # smart sudo alias trick! 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-* # Add path to any tools folder in /opt/miaou-*
for i in {/opt,$HOME}/miaou-*/tools; do [[ -d "$i" ]] && PATH=$PATH:$i; done || true for i in {/opt,$HOME}/miaou-*/tools; do [[ -d "$i" ]] && PATH=$PATH:$i; done || true

4
init.sh

@ -4,7 +4,7 @@ set -Eeuo pipefail
[ "$(id -u)" -ne 0 ] && echo 'root privilege required' && exit 1 [ "$(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 #remove /etc/skel/.bashrc
if [ -e /etc/skel/.bashrc ]; then if [ -e /etc/skel/.bashrc ]; then
@ -18,6 +18,6 @@ for i in "${arr[@]}"; do
if [[ -f "$i" ]] && [[ ! -f "$i.$ORIGINAL" ]]; then if [[ -f "$i" ]] && [[ ! -f "$i.$ORIGINAL" ]]; then
mv "$i" "$i.$ORIGINAL" mv "$i" "$i.$ORIGINAL"
basefile=$(basename "$i") basefile=$(basename "$i")
ln -s "$MIAOU_BASH_DIR/$basefile" "$i"
ln -s "$OPT_MIAOU_DIR/$basefile" "$i"
fi fi
done done
Loading…
Cancel
Save