Linux Shell 进度条显示函数(备忘)
1.点号进度显示code 1
#!/bin/sh
#输出"."进度条函数,兼容bsh、ksh、bash
#首先trap 1 2 3 15信号,重要
trap 'kill $BG_PID;echo;exit' 1 2 3 15
function dots
{
stty -echo >/dev/null 2>&1
while true
do
echo -e ".\c"
sleep 1
done
stty echo
echo
}
#---------------------------------------------
# 主程序开始
#---------------------------------------------
#首先使dots函数后台运行
dots &
BG_PID=$!
#开始程序主体,本例中执行休眠10秒
#注意必要时--8
2.井号进度显示code 2
#!/bin/sh
abort() {
printf "\033[m\n"
exit
}
#donothing,justsimulatetimeconsume.
idle() {
i=1
sum=`date +%S`
sum=`expr $sum \* $sum | cut -b1`
sum=`expr $sum \* 10`
while [ $i -le $sum ]
do
i=`expr $i + 2`
trap abort 2
done
}
proc() {
begin=$1
end=$2
row=$3
pos1=`expr $begin + 1`
pos2=`expr $end - 1`
mid=`echo "($begin+$end)/2-2" |bc`
printf "\033[2J"
printf "\033[${row};${begin}H["
printf "\033[${row};${end}H]"
echo ##########################$pos1 -le $pos2
while [ $pos1 -le $p
相关文档:
1. HCI层协议概述:
HCI提供一套统一的方法来访问Bluetooth底层。如图所示:
从图上可以看出,Host Controller Interface(HCI) 就是用来沟通Host和Module。Host通常就是PC, Module则是以各种物理连接形式(USB,serial,pc-card等)连接到PC上的bluetooth Dongle。
在Host这一端:application,SDP,L2cap等协议 ......
前面利用开发板带的现成的东西step by step让Linux 2.4.19在开发板上跑起来了,对于开发的流程也有了一定的认识。现在想对每一步进行详细深入的探讨,好好学习一下,把笔记记录下来,省得忘记了。有些内容是从看过的书中摘要过来的,大部分是自己实践后的心得。我想记得详细点,也好为后面总结打好基础。
------- ......
欢迎回到Kernel中……
继续说__vet_atags函数,这个函数仍旧定义在arch\arm\kernel\head-common.s文件中:
/* Determine validity of the r2 atags pointer. The heuristic requires
* that the pointer be aligned, in the first 16k of physical RAM and
* that the ATAG_CORE marker ......