learning shell display alert function
【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的更多相关文章
- learning shell monitor prog function
[Purpose] Shell script monitor prog function [Eevironment] Ubuntu 16.04 bash env [ ...
- 不知道哪里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 ...
- learning shell built-in variables (1)
Shell built-in variables [Purpose] Learning shell built-in variables, example $0,$1,$2,$3,$#, ...
- how to disabled alert function in javascript
how to disabled alert function in javascript alert 阻塞主线程 default alert; // ƒ alert() { [native code] ...
- learning shell args handing key=value example (2)
Shell args handing key=value example [Purpose] Learning how to handing ker=value args [Eevi ...
- learning shell script prompt to run with superuser privileges (4)
Shell script prompt to run with superuser privileges [Purpose] Check whether have root privil ...
- learning shell get script absolute path (3)
Shell get script absolute path [Purpose] Get shell script absolute path [Eevironment] ...
- learning shell check requires root privileges
[Purpose] Shell script check requires root privileges [Eevironment] Ubuntu 16.04 bas ...
- learning shell check host dependent pkg
[Purpose] Shell script check host dependent pkg [Eevironment] Ubuntu 16.04 bash env ...
随机推荐
- leecode第七十八题(子集)
class Solution { public: vector<vector<int>> subsets(vector<int>& nums) { vect ...
- CSS3一些常用动画
/* animation */ .a-bounce,.a-flip,.a-flash,.a-shake,.a-swing,.a-wobble,.a-ring{-webkit-animation:1s ...
- 小程序歌词展示,格式lrc歌词
代码: wxml: <view class="page"> <view class="lrc" style="margin-top: ...
- idataway_前端代码规范
1.前后端json对接的规范. 前后端的json代码规范 result ={ success:”true”,//true表示成功,false表示失败. data:{}, //数据 errorCode: ...
- 第 6 章 存储 - 042 - 用 volume container 共享数据
volume container volume container 是专门为其他容器提供 volume 的容器.它提供的卷可以是 bind mount,也可以是 docker managed volu ...
- appium --log-timestamp > appium.log
appium --log-timestamp > appium.log
- nodejs中function*、yield和Promise的示例
var co = require("co"); var fs = require("fs"); function cusReadFile(fileName) { ...
- Linux 各种软件的安装-Jenkins和svn结合
通常情况下,修改代码,打包,上传,发布,这么个顺序发布程序. 有了Jenkins这些重复性的操作可以统统交给程序自动处理.甚至可以指定发布的时机,例如提交一次svn就自动发布,每天定时发布等. 1:安 ...
- 数据结构(C语言版)-第1章 绪论
- Centos6.5 升级Openssl + Openssh
xu言: 平时很懒,都不想写blog.今天(2018.05.15)开始尝试每天写一篇吧,看我自己能坚持多久! 准备工作: 为了防止在操作过程中导致ssh远程中断,首先安装一个telnet-server ...