1:[当前目录] [.c .h] [文件] [总行数]
find . -name "*.[c,h]" -type f | xargs wc -l
|
2:(cscope, ctags) [生成链接] [脚本]
#!/bin/sh
find /scratchbox/users/yuanlin/targets/aquila-device/usr/include/ . -type f > cscope.files
cscope -bqk -i cscope.files
#if filename is not "cscope.files"
#you must add paratmeter "-i" ctags -R
|
3:(逐行读取文件)(打印)
#!/bin/bash
packages_file=$1
read_packages () {
while read LINE;
do
echo "$LINE"
done < $1
}
read_packages $packages_file
exit
|
4:(查找)(目录下文件)(包含指定字符的行)
find /usr/include | xargs grep "string"
|
5:输出hello+用户名(你系统登陆的那个),根据系统时间输出good morning /evening~
#!/bin/bash
if [ `date +%p` == "AM" ]
then
echo -e "hello `whoami`\n\t good morning"
elif [ `date +%p` == "PM" ]
then
echo -e "hello `whoami`\n\t good afternoon"
fi
|
阅读(626) | 评论(0) | 转发(0) |