#########################################################################
## label page title name
L0=$(pwd | grep -o '/' | wc -l)
L1=$(expr $L0 + 1)
mDIR=$(pwd | cut -d '/' -f "$L0 $L1")
#########################################################################
cc="\[\e[0m\]" #关闭颜色显示
#### 前景色 ###
c0="\[\e[30m\]" #黑 black
c1="\[\e[31m\]" #红 red
c2="\[\e[32m\]" #绿 green
c3="\[\e[33m\]" #黄 yellow
c4="\[\e[34m\]" #蓝 blue
c5="\[\e[35m\]" #紫 purple
c6="\[\e[36m\]" #青 cyan
c7="\[\e[37m\]" #白 white
#### 背景色 ####
bc0="\[\e[40m\]" #黑 black
bc1="\[\e[41m\]" #红 red
bc2="\[\e[42m\]" #绿 green
bc3="\[\e[43m\]" #黄 yellow
bc4="\[\e[44m\]" #蓝 blue
bc5="\[\e[45m\]" #紫 purple
bc6="\[\e[46m\]" #青 cyan
bc7="\[\e[47m\]" #白 white
#### 附加功能 ####
# 0 OFF
# 1 高亮显示
# 4 underline
# 5 闪烁
# 7 反白显示
# 8 不可见
# \e[1;43m #高亮显示
ip=`/sbin/ifconfig|grep 'inet '| awk '{print $2}' |grep -v '127.0.0.1'| awk -F ':' '{print $2}'`
OLDPWD=$PWD
mPS0='${debian_chroot:+($debian_chroot)}\[\033[01;32m\][\A@\h]\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
mPS1="$c0$bc3\ws$cc $c2*** $c3<\u@$ip> $c4***** $c5\! $c6***** $c7\t $c1***\n$c2\$|——> $cc";
mPS2="\e]2;\W: $*\a$c0$bc3\ws$cc $c2*** $c3<\u@$ip> $c4***** $c5\! $c6***** $c7\t $c1***\n$c2\$|——> $cc \a";
mPS3="\e]2;\W/ $*\a$c0$bc3\w$cc $c2*** $c3<\u@$ip> $c4***** $c5\! $c6***** $c7\t $c1***\n$c2\$|——> $cc \a";
mPS4="\e]2;\W/ $*\a$c0$bc3\w$cc $c2 $c3<\u@$ip> $c4 $c5\! $c6 $c7\t $c1*\n$c1└──$cc \a";
mPS5="\e]2;\W/ $*\a$c0$bc6\w$cc \$ $cc\a"; #简短型
mPS6="\e]2;$mDIR/ $*\a$c0$bc3\w$cc $c2*** $c3<\u@$ip> $c4***** $c5\! $c6***** $c7\t $c1***\n$c2\$|——> $cc \a"; #改标签页标题
#export PS1="[\e]2;\W: $*\a\u@\h \W]\$ \a"
export PS1=$mPS4
#######################################################################
export EDITOR=/usr/bin/vim
#this set for quick change your dir
export MARKPATH=$HOME/.marks
function jump {
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
}
function mark {
mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$1"
}
function unmark {
rm -i "$MARKPATH/$1"
}
function marks {
ls -l "$MARKPATH" |grep -v total|awk '{print $9 $10 $11}'
}
_completemarks() {
local curw=${COMP_WORDS[COMP_CWORD]}
local wordlist=$(find $MARKPATH -type l -printf "%f\t")
COMPREPLY=($(compgen -W '${wordlist[@]}' -- "$curw"))
return 0
}
complete -F _completemarks jump unmark
#######################################################################
#自定义脚本命令配置
#SCRIPT_PATH=/home/usr/08_script/shell/
#export PATH=${PATH}:${SCRIPT_PATH};
export SCRIPT_PATH=$HOME/08_script/shell/
export KNOWLEDGE=$HOME/07_doc/000_Little_knowledge
alias ad="$SCRIPT_PATH/adb.sh"
alias del="$SCRIPT_PATH/del.sh"
alias anr="python $SCRIPT_PATH/stack.py --symbols-dir=/home/user/poplar2/LINUX/android/out/target/product/fly/symbols"
alias cd2="cd ./../../"
alias cd3="cd ./../../../"
alias cd4="cd ./../../../../"
alias cd5="cd ./../../../../../"
alias cd6="cd ./../../../../../../"
alias cd7="cd ./../../../../../../../"
alias cd8="cd ./../../../../../../../../"
alias cd9="cd ./../../../../../../../../../"
#set for mistake trigger
alias sl="ls"
alias s="ls"
alias LS="ls"
alias SL="ls"
alias rm="rm -i"
#redshift
# find -name
alias f="find -name"
# date eg: 20180816
alias d="date +%Y%m%d"
alias h="date +%Y%m%d-%H%M"
#save log to file
alias dmesg2f="dmesg > dmesg-`h`"
alias alog2f="adb wait-for-device logcat > log-`h`"
# tar usage quick refer
alias tarus="echo '解包:tar zxvf FileName.tar'; echo '打包:tar czvf FileName.tar DirName'"
# git
alias gitd="git diff"
alias gitl='git log
#caculate usage: ? "5 * 5" ---> 25
? () { echo "$*" | bc -l; }
#du -h --max-depth=1 统计当前目录下每个文件夹的大小