Paste #252131

   
pasted on 27.01.2022 19:10
  • Edit to this paste
  • Print
  • Raw
  • The following pastes replied to this paste:  # 252154
  • Show paste tree
  • Compare with paste
    #  
  • Toggle line numbers
  • Syntax highlighting  
Text paste
  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
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
# ~/.bashrc: executed by bash(1) for non-login shells.

# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

#PS1="\[\033[32m\][\w]\[\033[0m\]\n\[\033[1;36m\]\u\[\033[1;33m\] $ \[\033[0m\]"

alias randr="xrandr --output LVDS1 --mode 1366x768 --output VGA1 --mode 1920x1080 --above LVDS1"
alias password="openssl rand 15 | base64 >> /home/volkov/paroles && nano /home/volkov/paroles"
alias check50='/usr/bin/node ~/check50/SOURCES/opt/check50/bin/'
alias cadaver='cadaver https://webdav.yandex.ru'
alias nano='vim'
export CC=/usr/bin/clang
export EDITOR=/usr/bin/vim

shopt -s no_empty_cmd_completion
shopt -s histappend
HISTSIZE=10000
HISTFILESIZE=10000
HISTTIMEFORMAT='%F %T %Z: '
HISTCONTROL=ignorespace:ignoredups
HISTIGNORE=''

prompt_command () {
    # set an error string for the prompt, if applicable
    if [ $? -eq 0 ]; then
        ERRPROMPT=" "
    else
        ERRPROMPT=" ($?) "
    fi
 
    local BRANCH=""
 
    local LOAD=`cut -d' ' -f1 /proc/loadavg`
    #local TIME=`date +"%d.%m.%Y %H:%M:%S"`
    local TIME=`date +"%H:%M:%S"`
    local CURENT_PATH=`echo ${PWD/#$HOME/\~}`
 
    # trim long path
    if [ ${#CURENT_PATH} -gt "35" ]; then
        let CUT=${#CURENT_PATH}-35
        CURENT_PATH="...$(echo -n $PWD | sed -e "s/\(^.\{$CUT\}\)\(.*\)/\2/")"
    fi
 
    local TITLEBAR="\[\e]2;${CURENT_PATH}\a\]"
 
    local GREEN="\[\033[0;32m\]"
    local CYAN="\[\033[0;36m\]"
    local BCYAN="\[\033[1;36m\]"
    local BLUE="\[\033[0;34m\]"
    local GRAY="\[\033[0;37m\]"
    local DKGRAY="\[\033[1;30m\]"
    local WHITE="\[\033[1;37m\]"
    local RED="\[\033[0;31m\]"
    # return color to Terminal setting for text color
    local DEFAULT="\[\033[0;39m\]"
 
    PROMPT="[ ${TIME}, ${LOAD}, ${USER}@${HOSTNAME} ]$ERRPROMPT [ ${CURENT_PATH} ]"
 
    # different prompt and color for root
    local PR="$ "
    local USERNAME_COLORED="${BCYAN}${USER}${GREEN}@${BCYAN}${HOSTNAME}"
    if [ "$UID" = "0" ]; then
        PR="# "
        USERNAME_COLORED="${RED}${USER}${GREEN}@${RED}${HOSTNAME}"
    fi
 
    # use only ASCII symbols in linux console
    local DASH="\e(0q\e(B"
    local TC="\[\e(0l\e(B\]"
    local BC="\[\e(0m\e(B\]"
    if [ "$TERM" = "xterm" ]; then
        TITLEBAR=""
        DASH="-"
        TC=""
        BC=""
    fi
 
    local SEPARATOR=""
    let FILLS=${COLUMNS}-${#PROMPT}
    for (( i=0; i<$FILLS; i++ )) do
        SEPARATOR=$SEPARATOR$DASH
    done
    history -n && history -a  
    local TOP_LINE="${GRAY}${TC}${CYAN}[ ${WHITE}${TIME}, ${DKGRAY}${LOAD}, ${USERNAME_COLORED} 
${CYAN}]${RED}$ERRPROMPT${CYAN}[ ${GRAY}${CURENT_PATH}${CYAN} ]${GRAY}${SEPARATOR}"
    local BOTTOM_LINE="${BC}${GREEN}${BRANCH}${CYAN}[ ${GREEN}${PR}${DEFAULT}"
    export PS1="${TITLEBAR}\n${TOP_LINE}\n${BOTTOM_LINE}"
}
PROMPT_COMMAND=prompt_command
Add Comment
Author