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
相关文档:
例一:发送Signaling Packet:
Signaling Command是2个Bluetooth实体之间的L2CAP层命令传输。所以得Signaling Command使用CID 0x0001.
多个Command可以在一个C-frame(control frame)中发送。
如果要直接发送Signaling Command.需要建立SOCK_RAW类型的L2CAP连接Socket。这样才有机会自己填充Command Code,Identi ......
linux/arch/i386/boot/compressed/head.S
在setup()结束后,此函数就被移动到物理地址0x00100000处或者0x00001000处,这取决于内核映像是被高装载到ram中还是低装载到ram中。
解读函数:
startup_32:
cld
cli
&n ......
体验一下linux下编写和使用动态库与静态库,范例:helloworld程序。
首先编写静态库:
hellos.h
#ifndef _HELLO_S_H
#define _HELLO_S_H
void prints(char *str);
#endif
hellos.c
#include "hellos.h"
#include <stdio.h>
void prints(char *str)
{
printf("print in sta ......
转载
(1)软连接可以 跨文件系统 ,硬连接不可以 。实践的方法就是用共享文件把windows下的 aa.txt文本文档连接到linux下/root目录 下 bb,cc . ln -s aa.txt /root/bb 连接成功 。ln aa.txt /root/bb 失败 。
(2)关于 I节点的问题 。硬连接不管有多少个,都指向的是同一个I节点,会把 结点连接数增加 ,只要结点的连接 ......
gprof介绍
gprof是GNU profiler工具,存在于binutils工具包。可以显示程序运行的“flat profile”,包括每个函数的调用次数,每个函数消耗的处理器时间。也可以显示“调用图”,包括函数的调用关系,每个函数调用花费了多少时间。还可以显示“注释的源代码”,是程序源代码的一个复本,标记 ......