annotate bash @ 44:1f1af28f36e9

[bash] Bashrc, c-style ifdef.
author Edho Prima Arief <me@myconan.net>
date Wed, 27 Apr 2011 21:15:16 +0700
parents b4965a1610f6
children 416f9d3e9ee8
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
44
1f1af28f36e9 [bash] Bashrc, c-style ifdef.
Edho Prima Arief <me@myconan.net>
parents: 43
diff changeset
3 [ -n "${echo_bash}" ] && return
1f1af28f36e9 [bash] Bashrc, c-style ifdef.
Edho Prima Arief <me@myconan.net>
parents: 43
diff changeset
4 ecos_bash=y
1f1af28f36e9 [bash] Bashrc, c-style ifdef.
Edho Prima Arief <me@myconan.net>
parents: 43
diff changeset
5
43
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
6 [ -f .bash.conf.before ] && . .bash.conf.before
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
7 _has_rm_I=
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
8 _has_gnu_ls=
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
9 _has_bsd_ls=
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
10 case "$(uname -s)" in
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
11 Linux)
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
12 _has_rm_I=y
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
13 _has_gnu_ls=y
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
14 ;;
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
15 SunOS)
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
16 [ -x /usr/gnu/bin/rm ] && _has_rm_I=y
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
17 [ -x /usr/gnu/bin/ls ] && _has_gnu_ls=y
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
18 ;;
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
19 *BSD)
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
20 _has_rm_I=y
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
21 ;;
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
22 esac
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
23
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
24 if [ $_has_rm_I = y ]; then
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
25 alias rm="rm -I"
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
26 else
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
27 alias rm="rm -i"
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
28 fi
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
29
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
30 if [ $_has_gnu_ls = y ]; then
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
31 alias ls="ls -F --color=auto"
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
32 else
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
33 alias ls="ls -F"
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
34 fi
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
35
b4965a1610f6 [bash] Yaaay bashrc.
Edho Prima Arief <me@myconan.net>
parents: 40
diff changeset
36 [ -f .bash.conf.after ] && . .bash.conf.after