Purpose

       Shell print function base on err info wrn ext output level

 

Eevironment

       Ubuntu 16.04 bash env

 

Procdeure

  Source code:

#!/bin/bash
DEST=/tmp
mkdir -p /tmp/debug
display_alert()
#--------------------------------------------------------------------------------------------------------------------------------
# Let's have unique way of displaying alerts
#--------------------------------------------------------------------------------------------------------------------------------
{
# log function parameters to install.log
#[[ -n $DEST ]] && echo "Displaying message: $@" >> $DEST/debug/output.log
local tmp=""
[[ -n $2 ]] && tmp="[\e[0;33m $2 \x1B[0m]"
case $3 in
err)
echo -e "[\e[0;31m error \x1B[0m] $1 $tmp"
;;
wrn)
echo -e "[\e[0;35m warn \x1B[0m] $1 $tmp"
;;
ext)
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0m $tmp"
;;
info)
echo -e "[\e[0;32m o.k. \x1B[0m] $1 $tmp"
;;
*)
echo -e "[\e[0;32m .... \x1B[0m] $1 $tmp"
;;
esac
}
display_alert "List of local repos" "local" "err"
display_alert "List of local repos" "local" "wrn"
display_alert "List of local repos" "local" "ext"
display_alert "List of local repos" "local" "info"
display_alert "List of local repos" "local" "other"
 

  Test method:

learning shell display alert function的更多相关文章

  1. learning shell monitor prog function

    [Purpose]        Shell script monitor prog function   [Eevironment]        Ubuntu 16.04 bash env   [ ...

  2. 不知道哪里alert undefined 用下面的语句是js报错.F12能提示报错的地方window.alert=function(aa){ if (typeof (aa)"undefined"){ throw "就是这";}};

    不知道哪里alert undefined 用下面的语句是js报错.F12能提示报错的地方 var oldalert=window.alert; window.alert=function(aa){ i ...

  3. learning shell built-in variables (1)

    Shell built-in variables [Purpose]        Learning shell built-in variables, example $0,$1,$2,$3,$#, ...

  4. how to disabled alert function in javascript

    how to disabled alert function in javascript alert 阻塞主线程 default alert; // ƒ alert() { [native code] ...

  5. learning shell args handing key=value example (2)

    Shell args handing key=value example [Purpose]        Learning how to handing ker=value args   [Eevi ...

  6. learning shell script prompt to run with superuser privileges (4)

    Shell script prompt to run with superuser privileges [Purpose]        Check whether have root privil ...

  7. learning shell get script absolute path (3)

    Shell get script absolute path [Purpose]        Get shell script absolute path   [Eevironment]       ...

  8. learning shell check requires root privileges

    [Purpose]        Shell script check requires root privileges   [Eevironment]        Ubuntu 16.04 bas ...

  9. learning shell check host dependent pkg

    [Purpose]        Shell script check host dependent pkg   [Eevironment]        Ubuntu 16.04 bash env ...

随机推荐

  1. VUE项目实现页面跳转

    打开一个VUE项目,目录结构是这样的: 如现在有两个页面aaa和HelloWorld,路由配置在index.js中: import Vue from 'vue' import Router from ...

  2. cocos2dx 如何获得节点的类型

    1. 需求:在所有子节点中得到是ui::Text类型的节点,并对其进行操作. 2. 解决方案:在根节点Node中有一个如下的函数: /** * Gets the description string. ...

  3. composer修改中文镜像

    composer config -g repo.packagist composer https://packagist.phpcomposer.com

  4. what are stop words

    what are stop words 一.总结 一句话总结:就是在seo的关键词中不要有stop words,不然的话搜索引擎会直接忽略 stop words  most common  words ...

  5. 怎么检测自己fastq的Phred类型 | phred33 phred64

    http://wiki.bits.vib.be/index.php/Identify_the_Phred_scale_of_quality_scores_used_in_fastQ # S - San ...

  6. pandas更换index,column名称

    1)仅换掉index名称 df.index = list 2)调整index时,后面的项目也要跟着调整: df.reindex(list) 注意如果list中出现了df中没有的index,后面的项目会 ...

  7. 8.2 DRAM和SRAM

    计算机组成 8 存储层次结构 8.2 DRAM和SRAM SRAM比较快,DRAM比较慢:SRAM比较贵,DRAM比较便宜.记住这些结论是很容易的,但是比是什么更重要的是为什么.那在这一节我们就从电路 ...

  8. LeetCode--345--反转字符串中的元音字母

    问题描述: 编写一个函数,以字符串作为输入,反转该字符串中的元音字母. 示例 1: 输入: "hello" 输出: "holle" 示例 2: 输入: &quo ...

  9. p1218 Superprime Rib

    深搜,添加数字后如果仍为质数,继续递归. #include <iostream> #include <cstdio> #include <cmath> #inclu ...

  10. vux,vue 苹果手机使用position:fixed有问题,如何解决

    苹果手机真是各种坑,导致我都想摔手机呀,但没办法,用苹果的人太多,程序员还是继续在坑的路上行走! 上一篇文章介绍了一些组件,就是使用vux可以解决,苹果手机使用position:fixed的问题 给需 ...