![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell 编程
ganggexiongqi
这个作者很懒,什么都没留下…
展开
-
private[1]
<br />#!/bin/bash myfun() { echo -e "read/n" i=1 minus=0 max=-32768 min=32767 avr=0 totel=0 num=`cat "$1"|wc -l` echo -e "num is $num/n" cat "$1" | while read line do var1=`cat "$1"|head -n $i|tail -n 1` #数字键盘的左边 var2=`cat "$2"|head -n $原创 2010-08-25 19:52:00 · 650 阅读 · 0 评论 -
Regular Expression
//test aaaa lover xxxxxx good goood goXXod joseph is a good man Joseph is a bad student Ai Bi Ci auto. Amy, you are my lovable+lover ababab space 123454321 space left cat t | grep "a\{3,3\}" -原创 2011-11-27 20:58:54 · 813 阅读 · 0 评论 -
shell function
====================== Use function in your script: = ====================== fun: #!/bin/bash #function defination func() { echo "function demon"; ls; echo "----------"; } func welc原创 2011-11-27 21:29:52 · 1209 阅读 · 0 评论 -
compare operation in shell
compare: #!/bin/bash debug=1 tf=1 string="abc" test $debug -eq 1 && { echo "hello, test" echo "hello, more" } if [ $debug = 0 ] || [ $tf -eq 0 ] || [ 0 ]; then echo $string fi test $debu原创 2011-11-29 00:38:29 · 655 阅读 · 0 评论 -
sed
another_file: text from another file! t_file: a bb ccc Joseph joseph last line date: 12-11-2011 DATE:12/11/2011 1 2 3 4 5 11 --> 22 1110111 sed cmd: #print原创 2011-11-30 00:19:38 · 1194 阅读 · 0 评论 -
c函数中执行shell 命令
在c函数中执行shell 命令 并获得命令的返回值 #include #include int main(void) { int ret = -1; FILE* pf; /* Can not get the output of the cmd */ ret = system("ls /dev/loop* | wc -l"); printf("r原创 2011-12-09 01:03:05 · 1571 阅读 · 0 评论 -
我的shell脚本库
1. 文件批量重命名 因为所用相机保存的照片格式为 *.JPG,但是要上传到QQ空间时只认识 *.jpg格式 所以转到所在目录下,执行如下脚本,以批量修改文件扩展名为*.jpg #!/bin/bash # # This script is used to change the file names to *.jpg # files=`ls` for f in $原创 2012-04-04 00:10:22 · 1027 阅读 · 0 评论 -
gdb 脚本
C程序: /* 编译:$gcc -g3 -o gs this_file.c */ #include int main(void) { int x = 3; if (x < 4) printf("AAAA\n"); else printf("BBBB\n");原创 2013-04-24 18:15:02 · 2021 阅读 · 0 评论