0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

bash設定ファイル

Last updated at Posted at 2022-07-04
bash_profile
# default:cyan / root:red
if [ $UID -eq 0 ]; then
    PS1="\[\033[31m\]\u@\h\[\033[00m\]:\[\033[01m\]\w\[\033[00m\]\\$ "
else
    PS1="\[\033[36m\]\u@\h\[\033[00m\]:\[\033[01m\]\w\[\033[00m\]\\$ "
fi

# "-F":ディレクトリに"/"を表示 / "-G"でディレクトリを色表示
alias ls='ls -FG'
alias ll='ls -alFG'

#ブランチ名表示
source /usr/local/etc/bash_completion.d/git-prompt.sh
source /usr/local/etc/bash_completion.d/git-completion.bash
GIT_PS1_SHOWDIRTYSTATE=true
#export PS1='\[\033[00m\]\u@\h\[\033[00m\]:\[\033[00m\]\w\[\033[33m\]$(__git_ps1)\[\033[00m\]\n\$ '
#export PS1='\[\033[00m\]\u@\h\[\033[00m\]:\[\033[00m\]\w\[\033[33m\]$(__git_ps1)\[\033[00m\] \$ '
export PS1='\[\033[00m\]\u@\A\[\033[00m\]:\[\033[00m\]\w\[\033[33m\]$(__git_ps1)\[\033[00m\] \$ '

# function parse_git_branch {
#     git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ [\1]/'
# }
# function promps {
#     # 色は気分で変えたいかもしれないので変す宣言しておく
#     local  BLUE="\[\e[1;34m\]"
#     local  RED="\[\e[1;31m\]"
#     local  GREEN="\[\e[1;32m\]"
#     local  WHITE="\[\e[00m\]"
#     local  GRAY="\[\e[1;37m\]"
#
#     case $TERM in
#         xterm*) TITLEBAR='\[\e]0;\W\007\]';;
#         *)      TITLEBAR="";;
#     esac
#     local BASE="\u@\h"
#     PS1="${TITLEBAR}${GREEN}${BASE}${WHITE}:${BLUE}\W${GREEN}\$(parse_git_branch)${BLUE}\$${Blue} "
# }
# promps

#git補完機能
source ~/.git-completion.bash

if [ -f ~/.bashrc ]; then
  . ~/.bashrc
fi

bashrc
# 出力の後に改行を入れる
function add_line {
  if [[ -z "${PS1_NEWLINE_LOGIN}" ]]; then
    PS1_NEWLINE_LOGIN=true
  else
    printf '\n'
  fi
}
PROMPT_COMMAND='add_line'


# "-F":ディレクトリに"/"を表示 / "-G"でディレクトリを色表示
alias ls='ls -FG'
alias ll='ls -alFG'
alias rm='rm -i'
alias grep='grep --color=auto'

cd ()
{
    builtin cd "$@" && ls
}

#docker
alias d='docker'
alias dp='docker ps'
alias di='docker images'
alias dc='docker-compose'
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?