annotate bash @ 107:06637c6cdc90

Merge
author Edho Prima Arief <edho@myconan.net>
date Sat, 17 Sep 2011 01:11:11 +0700
parents 4e44a9c03a3a
children c3e641108696 fd8dbd4bb758
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
1 #!/usr/bin/env bash
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
2
71
40236fd0a3a5 Explicit path checking.
Edho Prima Arief <me@myconan.net>
parents: 67
diff changeset
3 [ -f "${HOME}/.ecos_bash.before" ] && . "${HOME}/.ecos_bash.before"
49
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
4
67
4510c8a9d8ec [bash] We have cygwin!
Edho Prima Arief <me@myconan.net>
parents: 63
diff changeset
5 _org_path="${PATH}"
62
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
6 export PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
44
1f1af28f36e9 [bash] Bashrc, c-style ifdef.
Edho Prima Arief <me@myconan.net>
parents: 43
diff changeset
7
106
4e44a9c03a3a Saner ctrl-w for bash
Edho Prima Arief <edho@myconan.net>
parents: 103
diff changeset
8 #ensures slash doesn't get killed when doing ^W
4e44a9c03a3a Saner ctrl-w for bash
Edho Prima Arief <edho@myconan.net>
parents: 103
diff changeset
9 stty werase undef
4e44a9c03a3a Saner ctrl-w for bash
Edho Prima Arief <edho@myconan.net>
parents: 103
diff changeset
10 bind '\C-w':unix-filename-rubout
4e44a9c03a3a Saner ctrl-w for bash
Edho Prima Arief <edho@myconan.net>
parents: 103
diff changeset
11
103
0e8018fb4203 Color prompt
Edho Prima Arief <edho@myconan.net>
parents: 102
diff changeset
12 #PS1='[\u@\h \W]\$ '
0e8018fb4203 Color prompt
Edho Prima Arief <edho@myconan.net>
parents: 102
diff changeset
13 PS1='[\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\] \[\e[1;34m\]\W\[\e[0m\]]\$ '
49
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
14
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
15 export PAGER="less -Rins"
49
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
16 export EDITOR=vi
89
29bd7f6ef58a Explicit LANG declaration.
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
17 export LANG="en_US.UTF-8"
101
a1c6b40a535f Ensure no Ubuntuism's ls color bastardization.
Edho Prima Arief <edho@myconan.net>
parents: 96
diff changeset
18 unset LS_COLORS
49
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
19
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
20 alias less="less -Rins"
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
21 #assuming POSIX grep
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
22 alias fgrep="grep -F"
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
23 alias egrep="grep -E"
62
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
24 alias ls="ls -F"
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
25 alias rm="rm -i"
75
f993714efa7b cool alias, bro (rdesktop)
Edho Prima Arief <me@myconan.net>
parents: 71
diff changeset
26 alias rd="rdesktop -g 1280x600 -K -a 16 -z -P -r sound:off -r clipboard:CLIPBOARD -5"
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
27
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
28 _has_rm_I=
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
29 _has_gnu_ls=
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
30 _has_gnu_grep=
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
31 case "$(uname -s)" in
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
32 Linux)
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
33 _has_rm_I=y
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
34 _has_gnu_ls=y
96
26c9dc482051 Merge. Linux obviously has gnu grep.
Edho Prima Arief <edho@myconan.net>
parents: 75
diff changeset
35 _has_gnu_grep=y
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
36 ;;
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
37 SunOS)
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
38 [ -x /usr/gnu/bin/rm ] && _has_rm_I=y
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
39 [ -x /usr/gnu/bin/ls ] && _has_gnu_ls=y
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
40 [ -x /usr/gnu/bin/grep ] && _has_gnu_grep=y
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
41 [ -d /usr/xpg4/bin ] && PATH="/usr/xpg4/bin:${PATH}"
50
b7a63c71b07f [bash] export PATH last, added various default solaris PATH.
Edho Prima Arief <me@myconan.net>
parents: 49
diff changeset
42 [ -d /opt/csw/bin ] && PATH="/opt/csw/bin:${PATH}"
b7a63c71b07f [bash] export PATH last, added various default solaris PATH.
Edho Prima Arief <me@myconan.net>
parents: 49
diff changeset
43 [ -d /opt/csw/sbin ] && PATH="/opt/csw/sbin:${PATH}"
51
4496c7bf953d [bash] csw after gnu
Edho Prima Arief <me@myconan.net>
parents: 50
diff changeset
44 [ -d /usr/gnu/bin ] && PATH="/usr/gnu/bin:${PATH}"
62
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
45 export PATH
57
ada5b9534765 [bash] Sanitize sunos ping.
Edho Prima Arief <me@myconan.net>
parents: 56
diff changeset
46 alias ping="ping -s"
ada5b9534765 [bash] Sanitize sunos ping.
Edho Prima Arief <me@myconan.net>
parents: 56
diff changeset
47 alias ping6="ping -A inet6"
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
48 ;;
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
49 FreeBSD)
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
50 _has_rm_I=y
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
51 CLICOLOR=
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
52 ;;
62
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
53 OpenBSD)
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
54 if command -v colorls > /dev/null 2>&1; then
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
55 export CLICOLOR=
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
56 alias ls='colorls -F'
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
57 fi
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
58 ;;
67
4510c8a9d8ec [bash] We have cygwin!
Edho Prima Arief <me@myconan.net>
parents: 63
diff changeset
59 CYGWIN*)
4510c8a9d8ec [bash] We have cygwin!
Edho Prima Arief <me@myconan.net>
parents: 63
diff changeset
60 export PATH="${PATH}:${_org_path}"
4510c8a9d8ec [bash] We have cygwin!
Edho Prima Arief <me@myconan.net>
parents: 63
diff changeset
61 ;;
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
62 esac
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
63
62
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
64 [ "${_has_rm_I}" = y ] && alias rm="rm -I"
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
65 [ "${_has_gnu_ls}" = y ] && alias ls="ls -F --color=auto"
996aa2f81721 [bash] various fixes:
Edho Prima Arief <me@myconan.net>
parents: 60
diff changeset
66 [ "${_has_gnu_grep}" = y ] && alias grep="grep --color=auto"
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
67
49
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
68 unset _has_rm_I
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
69 unset _has_gnu_ls
58
73b2fccc4f06 [bash] missed unset.
Edho Prima Arief <me@myconan.net>
parents: 57
diff changeset
70 unset _has_gnu_grep
49
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
71
56
9343fa4dfd91 [bash] we have vim. Probably.
Edho Prima Arief <me@myconan.net>
parents: 55
diff changeset
72
59
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
73 case "${TERM}" in
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
74 xterm*|screen*|dtterm)
60
be4d0b045487 [bash] LOGNAME instead of USER since the former is more widely available (ie. USER is not set after `sudo su -` on solaris).
Edho Prima Arief <me@myconan.net>
parents: 59
diff changeset
75 PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007"'
59
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
76 ;;
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
77 esac
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
78
63
b7814634220a [bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents: 62
diff changeset
79 if command -v vim > /dev/null 2>&1; then
b7814634220a [bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents: 62
diff changeset
80 alias vi=vim
b7814634220a [bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents: 62
diff changeset
81 export EDITOR=vim
b7814634220a [bash] branch merge, added EDITOR change to vim when detected.
Edho Prima Arief <me@myconan.net>
parents: 62
diff changeset
82 fi
71
40236fd0a3a5 Explicit path checking.
Edho Prima Arief <me@myconan.net>
parents: 67
diff changeset
83 [ -f "${HOME}/.ecos_bash.after" ] && . "${HOME}/.ecos_bash.after"