zoukankan      html  css  js  c++  java
  • bash shell configuration

    1 In general

    ANSI/VT100 转义序列可用于各种编程语言
    e
    33
    x1B
    这3个命令都是设置颜色和类型的开始命令

    2 Example

    function git_branch {
    branch="`git branch 2>/dev/null | grep "^*" | sed -e "s/^* //"`"
    if [ "${branch}" != "" ];then
    if [ "${branch}" = "(no branch)" ];then
    branch="(`git rev-parse --short HEAD`...)"
    fi
    echo " ($branch)"
    fi
    }
    
    var='[e[48;5;28m][!][e[45m]u@h[e[m] [e[44m]w[e[m] \
    [e[01;32m]$(git_branch)[33[00m] [e[01;32m]$ [33[00m]'
    
    export PS1=$var
    

    The picture as follow:

    3 Illustration

    code description
    e[48;5;28m background color (resolution256) is green, foreground color is white(default)
    ]!] history command line number
    e[45m background color is pink
    u username
    h host machine name
    e[44m background color is blue
    w absolute path
    e[m as a end used to end up the front color setting
    [] it is important to use to avoid PS1 is covered by command line, and correctly calculate autowrap
    e[01;32m foreground text bold and color green
    $ root user is #, and other normal user is $
    e[00m used to restore the default setting
    used to change new line

    4 Reference web link

    bash color setting reference: https://blog.csdn.net/u010632165/article/details/92811856

    --------------------------------------------- Study needs record, record needs review ---------------------------------------------
  • 相关阅读:
    离散数学--第十章 群,环,域
    离散数学--十一章 格与布尔代数
    matplotlib 基础|笔记
    CF Round #632 div2
    Codeforces Round#630 div2
    PVZ 2--攻略合集?
    【POJ
    【POJ
    【Aizu
    【Aizu
  • 原文地址:https://www.cnblogs.com/georgemxx/p/14837108.html
Copyright © 2011-2022 走看看