shell
文章平均质量分 78
kld2009
这个作者很懒,什么都没留下…
展开
-
shell笔记(三)——其他循环结构
=====================================while语句======================================== while语句格式 while 表达式 do command command done while 和 if 的条件表达式完全相同,也是原创 2013-07-29 20:42:56 · 511 阅读 · 0 评论 -
shell笔记(二)——for循环
先通过一个例子认识下shell的for循环:#!/bin/bash echo "----start----" for((i=0;i<=100;i++)) do if((i%3==0)) then echo $i >> date.txt; fi done cat date.txt |xargs -n 20 执行结果: kldong@ubuntu:~/learning/shell$ ./test_原创 2013-07-28 23:00:20 · 529 阅读 · 0 评论 -
shell笔记(五)——函数
linux shell 可以用户定义函数,然后在shell脚本中可以随便调用。下面说说它的定义方法,以及调用需要注意那些事项。 一、定义shell函数(define function) 语法: [ function ] funname [()] { action; [return int;] } 说明: 1、可以带function fun()原创 2013-07-31 20:38:40 · 553 阅读 · 0 评论 -
shell笔记(一)——基本知识
1.把src文件夹下的所有名字中包含init字段的C文件拷贝到dsc目录里。#!/bin/bash echo "------start------" cd ./src/ find -name "*.c" |grep "init" |xargs -i cp {} ../dsc/原创 2013-07-27 14:40:18 · 618 阅读 · 0 评论 -
shell笔记(四)——if语句需要注意的事项
[ ] && ——快捷if [ -f "/etc/shadow" ] && echo "This computer uses shadow passwors" && 可以理解为then 如果左边的表达式为真则执行右边的语句 shell的if与c语言if的功能上的区别 shell if c语言if原创 2013-07-29 20:47:13 · 756 阅读 · 0 评论