-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bashrc
More file actions
71 lines (62 loc) · 2.09 KB
/
.bashrc
File metadata and controls
71 lines (62 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
# PS1
#PS1='[\u@\h \W]\$ '
if [ $UID -ge 1000 ]; then
PS1="\[\033[37m\]┏─[\[\e[36m\]\u\[\033[0m\]@\[\e[32m\]\H\[\033[37m\]]─[\[\033[0;33m\]\$(date \"+%H:%M\")\[\033[37m\]] \n\[\033[37m\]┗─[\[\033[0;36m\]\W\[\033[37m\]]> \[\e[0m\]"
elif [ $UID -eq 0 ]; then
PS1="\[\033[37m\]┏─[\[\033[0;31m\]\u\[\033[0m\]@\[\e[32m\]\H\[\033[37m\]]─[\[\033[0;33m\]\$(date \"+%H:%M\")\[\033[37m\]] \n\[\033[37m\]┗─[\[\033[0;36m\]\W\[\033[37m\]]> \[\e[0m\]"
fi
# 设置终端为256色
if [ -e /usr/share/terminfo/x/xterm-256color ]; then
export TERM='xterm-256color'
else
export TERM='xterm-color'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# emacs aliases
alias en='emacs -nw'
alias et='emacsclient -t -a ""'
alias ec='emacsclient -c -a ""'
## take a timestamped screenshot
shot(){
local PIC="${HOME}/photos/screenshot/screenshot-$(date +%Y-%m-%d_%H:%M:%S).png"
scrot $PIC
}
# Creates an archive from given directory
mktar() { tar cvf "${1%%/}.tar" "${1%%/}/"; }
mktgz() { tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; }
mktbz() { tar cvjf "${1%%/}.tar.bz2" "${1%%/}/"; }
# Extract Stuff
extract () {
if [ -f $1 ]; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via
extract()"
;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Add environment variable COCOS_CONSOLE_ROOT for cocos2d-x
#export COCOS_CONSOLE_ROOT=${HOME}/workspace/cocos2d-x-3.1/tools/cocos2d-console/bin
#export PATH=$COCOS_CONSOLE_ROOT:$PATH