annotate bash @ 61:81d132d8c757

[inputrc] Added history search for gnome terminal version.
author Edho Prima Arief <me@myconan.net>
date Sun, 08 May 2011 09:42:06 +0700
parents be4d0b045487
children 996aa2f81721 29bd7f6ef58a
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
49
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
3 [ -f .ecos_bash.before ] && . .ecos_bash.before
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
4
50
b7a63c71b07f [bash] export PATH last, added various default solaris PATH.
Edho Prima Arief <me@myconan.net>
parents: 49
diff changeset
5 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
6
55
c6d78ab9af22 [bash] turns out one of those that requires '.
Edho Prima Arief <me@myconan.net>
parents: 54
diff changeset
7 PS1='[\u@\h \W]\$ '
49
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
8
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
9 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
10 export EDITOR=vi
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
11
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
12 alias less="less -Rins"
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
13 #assuming POSIX grep
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
14 alias fgrep="grep -F"
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
15 alias egrep="grep -E"
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
16
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
17 _has_rm_I=
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
18 _has_gnu_ls=
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
19 _has_gnu_grep=
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
20 _has_bsd_ls=
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
21 case "$(uname -s)" in
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
22 Linux)
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
23 _has_rm_I=y
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
24 _has_gnu_ls=y
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
25 ;;
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
26 SunOS)
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
27 [ -x /usr/gnu/bin/rm ] && _has_rm_I=y
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
28 [ -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
29 [ -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
30 [ -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
31 [ -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
32 [ -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
33 [ -d /usr/gnu/bin ] && PATH="/usr/gnu/bin:${PATH}"
57
ada5b9534765 [bash] Sanitize sunos ping.
Edho Prima Arief <me@myconan.net>
parents: 56
diff changeset
34 alias ping="ping -s"
ada5b9534765 [bash] Sanitize sunos ping.
Edho Prima Arief <me@myconan.net>
parents: 56
diff changeset
35 alias ping6="ping -A inet6"
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
36 ;;
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
37 FreeBSD)
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
38 _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
39 CLICOLOR=
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
40 ;;
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
41 esac
52
d07ce874a280 [bash] securing test. Should use bashism but I hate bashism.
Edho Prima Arief <me@myconan.net>
parents: 51
diff changeset
42 if [ "${_has_rm_I}" = y ]; then
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
43 alias rm="rm -I"
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
44 else
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
45 alias rm="rm -i"
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
46 fi
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
47
52
d07ce874a280 [bash] securing test. Should use bashism but I hate bashism.
Edho Prima Arief <me@myconan.net>
parents: 51
diff changeset
48 if [ "${_has_gnu_ls}" = y ]; then
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
49 alias ls="ls -F --color=auto"
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
50 else
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
51 alias ls="ls -F"
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
52 fi
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
53
53
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
54 if [ "${_has_gnu_grep}" = y ]; then
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
55 alias grep="grep --color=auto"
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
56 fi
b9db5d89aae3 [bash] POSIX grep, GNU grep, standardized quote (" unless ' required).
Edho Prima Arief <me@myconan.net>
parents: 52
diff changeset
57
49
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
58 unset _has_rm_I
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
59 unset _has_gnu_ls
58
73b2fccc4f06 [bash] missed unset.
Edho Prima Arief <me@myconan.net>
parents: 57
diff changeset
60 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
61 unset _has_bsd_ls
b924652e169d [bash] Various tweaks: prompt, unset for check variables, etc
Edho Prima Arief <me@myconan.net>
parents: 48
diff changeset
62
50
b7a63c71b07f [bash] export PATH last, added various default solaris PATH.
Edho Prima Arief <me@myconan.net>
parents: 49
diff changeset
63 export PATH
56
9343fa4dfd91 [bash] we have vim. Probably.
Edho Prima Arief <me@myconan.net>
parents: 55
diff changeset
64
59
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
65 case "${TERM}" in
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
66 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
67 PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007"'
59
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
68 ;;
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
69 esac
757576a3fa79 [bash] titlebar!
Edho Prima Arief <me@myconan.net>
parents: 58
diff changeset
70
56
9343fa4dfd91 [bash] we have vim. Probably.
Edho Prima Arief <me@myconan.net>
parents: 55
diff changeset
71 command -v vim > /dev/null 2>&1 && alias vi=vim
48
416f9d3e9ee8 [bash] Forgot the .bash.conf => .ecos_bash change.
Edho Prima Arief <me@myconan.net>
parents: 44
diff changeset
72 [ -f .ecos_bash.after ] && . .ecos_bash.after