Commit 47658d77bcbabc089c5279138ebbd065669015b1
1 parent
4edb016501
Exists in
master
and in
2 other branches
WebStorm
Showing 1 changed file with 1 additions and 0 deletions Inline Diff
templates/bashrc.sh
1 | #@IgnoreInspection AddShebang | ||
1 | # If not running interactively, don't do anything | 2 | # If not running interactively, don't do anything |
2 | case $- in | 3 | case $- in |
3 | *i*) ;; | 4 | *i*) ;; |
4 | *) return;; | 5 | *) return;; |
5 | esac | 6 | esac |
6 | 7 | ||
7 | ######################## | 8 | ######################## |
8 | # ******************** # | 9 | # ******************** # |
9 | # * * # | 10 | # * * # |
10 | # * COMPLETION * # | 11 | # * COMPLETION * # |
11 | # * * # | 12 | # * * # |
12 | # ******************** # | 13 | # ******************** # |
13 | ######################## | 14 | ######################## |
14 | 15 | ||
15 | # enable bash completion in interactive shells | 16 | # enable bash completion in interactive shells |
16 | if [ -f /etc/bash_completion ]; then | 17 | if [ -f /etc/bash_completion ]; then |
17 | . /etc/bash_completion | 18 | . /etc/bash_completion |
18 | fi | 19 | fi |
19 | 20 | ||
20 | # if the command-not-found package is installed, use it | 21 | # if the command-not-found package is installed, use it |
21 | if [ -x /usr/lib/command-not-found ]; then | 22 | if [ -x /usr/lib/command-not-found ]; then |
22 | function command_not_found_handle { | 23 | function command_not_found_handle { |
23 | # check because c-n-f could've been removed in the meantime | 24 | # check because c-n-f could've been removed in the meantime |
24 | if [ -x /usr/lib/command-not-found ]; then | 25 | if [ -x /usr/lib/command-not-found ]; then |
25 | /usr/bin/python /usr/lib/command-not-found -- $1 | 26 | /usr/bin/python /usr/lib/command-not-found -- $1 |
26 | return $? | 27 | return $? |
27 | else | 28 | else |
28 | return 127 | 29 | return 127 |
29 | fi | 30 | fi |
30 | } | 31 | } |
31 | fi | 32 | fi |
32 | 33 | ||
33 | ######################## | 34 | ######################## |
34 | # ******************** # | 35 | # ******************** # |
35 | # * * # | 36 | # * * # |
36 | # * HISTORY * # | 37 | # * HISTORY * # |
37 | # * * # | 38 | # * * # |
38 | # ******************** # | 39 | # ******************** # |
39 | ######################## | 40 | ######################## |
40 | 41 | ||
41 | # Eternal bash history. | 42 | # Eternal bash history. |
42 | # --------------------- | 43 | # --------------------- |
43 | export HISTFILESIZE= | 44 | export HISTFILESIZE= |
44 | export HISTSIZE= | 45 | export HISTSIZE= |
45 | export HISTTIMEFORMAT="[%F %T] " | 46 | export HISTTIMEFORMAT="[%F %T] " |
46 | # Change the file location | 47 | # Change the file location |
47 | export HISTFILE=~/.new_bash_history | 48 | export HISTFILE=~/.new_bash_history |
48 | # Force prompt to write history after every command | 49 | # Force prompt to write history after every command |
49 | PROMPT_COMMAND="history -a; $PROMPT_COMMAND" | 50 | PROMPT_COMMAND="history -a; $PROMPT_COMMAND" |
50 | 51 | ||
51 | 52 | ||
52 | # check the window size after each command | 53 | # check the window size after each command |
53 | shopt -s checkwinsize | 54 | shopt -s checkwinsize |
54 | 55 | ||
55 | # If set, the pattern "**" used in a pathname expansion context will | 56 | # If set, the pattern "**" used in a pathname expansion context will |
56 | # match all files and zero or more directories and subdirectories. | 57 | # match all files and zero or more directories and subdirectories. |
57 | #shopt -s globstar | 58 | #shopt -s globstar |
58 | 59 | ||
59 | # set variable identifying the chroot you work in (used in the prompt below) | 60 | # set variable identifying the chroot you work in (used in the prompt below) |
60 | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then | 61 | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then |
61 | debian_chroot=$(cat /etc/debian_chroot) | 62 | debian_chroot=$(cat /etc/debian_chroot) |
62 | fi | 63 | fi |
63 | 64 | ||
64 | # set a fancy prompt | 65 | # set a fancy prompt |
65 | case "$TERM" in | 66 | case "$TERM" in |
66 | xterm-color) color_prompt=yes;; | 67 | xterm-color) color_prompt=yes;; |
67 | esac | 68 | esac |
68 | 69 | ||
69 | # colored prompt | 70 | # colored prompt |
70 | force_color_prompt=yes | 71 | force_color_prompt=yes |
71 | 72 | ||
72 | if [ -n "$force_color_prompt" ]; then | 73 | if [ -n "$force_color_prompt" ]; then |
73 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | 74 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then |
74 | # We have color support; assume it's compliant with Ecma-48 | 75 | # We have color support; assume it's compliant with Ecma-48 |
75 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such | 76 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such |
76 | # a case would tend to support setf rather than setaf.) | 77 | # a case would tend to support setf rather than setaf.) |
77 | color_prompt=yes | 78 | color_prompt=yes |
78 | else | 79 | else |
79 | color_prompt= | 80 | color_prompt= |
80 | fi | 81 | fi |
81 | fi | 82 | fi |
82 | 83 | ||
83 | if [ "$color_prompt" = yes ]; then | 84 | if [ "$color_prompt" = yes ]; then |
84 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | 85 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' |
85 | else | 86 | else |
86 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | 87 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' |
87 | fi | 88 | fi |
88 | #unset color_prompt force_color_prompt | 89 | #unset color_prompt force_color_prompt |
89 | 90 | ||
90 | # enable color support of ls and also add handy aliases | 91 | # enable color support of ls and also add handy aliases |
91 | if [ -x /usr/bin/dircolors ]; then | 92 | if [ -x /usr/bin/dircolors ]; then |
92 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | 93 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" |
93 | alias ls='ls --color=auto' | 94 | alias ls='ls --color=auto' |
94 | alias dir='dir --color=auto' | 95 | alias dir='dir --color=auto' |
95 | alias vdir='vdir --color=auto' | 96 | alias vdir='vdir --color=auto' |
96 | 97 | ||
97 | alias grep='grep --color=auto' | 98 | alias grep='grep --color=auto' |
98 | alias fgrep='fgrep --color=auto' | 99 | alias fgrep='fgrep --color=auto' |
99 | alias egrep='egrep --color=auto' | 100 | alias egrep='egrep --color=auto' |
100 | fi | 101 | fi |
101 | 102 | ||
102 | 103 | ||
103 | # Alias definitions | 104 | # Alias definitions |
104 | 105 | ||
105 | if [ -f ~/.bash_aliases ]; then | 106 | if [ -f ~/.bash_aliases ]; then |
106 | . ~/.bash_aliases | 107 | . ~/.bash_aliases |
107 | fi | 108 | fi |
108 | 109 |