![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell 编程
ganggexiongqi
这个作者很懒,什么都没留下…
展开
-
private[1]
<br />#!/bin/bashmyfun(){echo -e "read/n"i=1minus=0max=-32768min=32767avr=0totel=0num=`cat "$1"|wc -l`echo -e "num is $num/n"cat "$1" | while read linedo var1=`cat "$1"|head -n $i|tail -n 1` #数字键盘的左边 var2=`cat "$2"|head -n $原创 2010-08-25 19:52:00 · 673 阅读 · 0 评论 -
Regular Expression
//testaaaaloverxxxxxx goodgooodgoXXodjoseph is a good man Joseph is a bad studentAiBiCiauto.Amy, you are my lovable+loverabababspace 123454321 space leftcat t | grep "a\{3,3\}" -原创 2011-11-27 20:58:54 · 819 阅读 · 0 评论 -
shell function
====================== Use function in your script: =======================fun:#!/bin/bash#function definationfunc() { echo "function demon"; ls; echo "----------"; }funcwelc原创 2011-11-27 21:29:52 · 1216 阅读 · 0 评论 -
compare operation in shell
compare:#!/bin/bashdebug=1 tf=1string="abc"test $debug -eq 1 && { echo "hello, test" echo "hello, more"}if [ $debug = 0 ] || [ $tf -eq 0 ] || [ 0 ]; then echo $stringfitest $debu原创 2011-11-29 00:38:29 · 661 阅读 · 0 评论 -
sed
another_file:text from another file!t_file:abb ccc Josephjosephlast linedate: 12-11-2011DATE:12/11/2011 1234511 --> 221110111sed cmd:#print原创 2011-11-30 00:19:38 · 1202 阅读 · 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 · 1579 阅读 · 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 · 1032 阅读 · 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 · 2039 阅读 · 0 评论