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 ---------------------------------------------
  • 相关阅读:
    解决验证码问题
    python中的偏函数partial
    Python 数据表orm设计
    参悟yield 和yield from (加精)
    numpy基础
    JS中的面向对象
    pandas使用教程
    一次tornado建站项目分享
    django 一对一, 一对多,多对多的领悟
    三维向量类
  • 原文地址:https://www.cnblogs.com/georgemxx/p/14837108.html
Copyright © 2011-2022 走看看