diff options
Diffstat (limited to 'shrc')
-rw-r--r-- | shrc | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/shrc b/shrc new file mode 100644 index 0000000..8b23731 --- /dev/null +++ b/shrc | |||
@@ -0,0 +1,72 @@ | |||
1 | # ~/.shrc -*- sh -*- | ||
2 | |||
3 | case $- in # only do these things in interactive shells | ||
4 | *i*) . ~/.profile ;; | ||
5 | *) return ;; | ||
6 | esac | ||
7 | |||
8 | # Prompt | ||
9 | # smileycode() { | ||
10 | # case $? in | ||
11 | # (0) printf '\e[32m%s\e[0m' '^_^' ;; | ||
12 | # (*) printf '\e[31m%s\e[0m' ';_;' ;; | ||
13 | # esac | ||
14 | # } | ||
15 | |||
16 | ecdollar() { | ||
17 | case $? in | ||
18 | (0) return ;; | ||
19 | (*) printf '*%s ' "$?" ;; | ||
20 | esac | ||
21 | } | ||
22 | |||
23 | pwd_tilde() { | ||
24 | printf '%s' "$PWD" | sed 's,'"$HOME"',~,' | ||
25 | } | ||
26 | |||
27 | case "$0" in | ||
28 | *ksh) | ||
29 | PS1=$'\1\r$(smileycode)\1 ' | ||
30 | PS1+=$'\1\e[34m\1$(pwd_tilde)\1\e[0m\1 ' | ||
31 | PS1+=$'$ ' | ||
32 | ;; | ||
33 | *) PS1='$(ecdollar)\$ \[\e[4m\]\w\[\e[0m\] > ' | ||
34 | ;; | ||
35 | esac | ||
36 | |||
37 | # Aliases | ||
38 | alias ls='ls --color=none -F ' | ||
39 | alias ll='ls -Al' | ||
40 | |||
41 | alias sudo=$SUDO | ||
42 | for cmd in shutdown reboot halt mount umount poweroff zzz ZZZ | ||
43 | do alias $cmd="$SUDO $cmd" | ||
44 | done | ||
45 | |||
46 | # installedp is in ~/.profile | ||
47 | if installedp bc | ||
48 | then export BC_ENV_ARGS='-lq' | ||
49 | fi | ||
50 | |||
51 | if installedp less | ||
52 | then export LESS='--mouse --RAW-CONTROL-CHARS' | ||
53 | fi | ||
54 | |||
55 | if installedp apk | ||
56 | then | ||
57 | _apk() ( | ||
58 | apk=$(which apk) | ||
59 | case "$1" in | ||
60 | (add|del|update|upgrade) $SUDO "$apk" "$@" ;; | ||
61 | (*) "$apk" "$@" ;; | ||
62 | esac | ||
63 | ) | ||
64 | alias apk=_apk | ||
65 | fi | ||
66 | |||
67 | if installedp rlwrap | ||
68 | then | ||
69 | for cmd in sbcl | ||
70 | do alias $cmd="rlwrap $cmd" | ||
71 | done | ||
72 | fi | ||