ちょっとだけ使い勝手変えたい時の.bashrcメモ

Jan 20, 2018 15:54 · 75 words · 1 minute read Development Bash

ちょっとだけ使い勝手変えたい時の.bashrcメモ

function check-shell-command {
  if [ $? -eq 0 ]; then
    face="\e[32m(*'-')"
  else
    face="\e[34m(*;-;)"
  fi

  echo -e "${face}\e[m"
}

PS1='$(check-shell-command)\[\e[33m\]$(if git status &>/dev/null;then echo " "\($(git branch | grep -F "*" |cut -d" " -f2-)$(if [ $(git status -s | wc -l) -ge 1 ];then echo "*";else echo "";fi)\);fi)\[\e[0m\] \$ '