27 lines
701 B
Plaintext
27 lines
701 B
Plaintext
alias e='gvim ~/.bashrc'
|
|
alias s='source ~/.bashrc'
|
|
alias eg='gvim ~/.vimrc'
|
|
|
|
#******************** set prompt ********************
|
|
free_mem()
|
|
{
|
|
free -m | awk 'NR==2{printf "%.2fG", $4/1024}'
|
|
}
|
|
w5(){
|
|
current_dir=$(pwd)
|
|
IFS='/' read -r -a dir_array <<< "$current_dir"
|
|
array_length=${#dir_array[@]}
|
|
if [ $array_length -gt 5 ]; then
|
|
start_index=$((array_length - 5))
|
|
short_path="/"
|
|
for (( i=$start_index; i<$array_length; i++ )); do
|
|
short_path+="${dir_array[i]}/"
|
|
done
|
|
echo "${short_path%?}"
|
|
else
|
|
echo "$current_dir"
|
|
fi
|
|
}
|
|
|
|
export PS1="[\[\e[01;32m\]\u@\h\[\e[00m\]-\t \$(free_mem)]:\[\e[01;34m\]\$(w5)\[\e[00m\]\$ "
|