Chinaunix首页 | 论坛 | 博客
  • 博客访问: 398719
  • 博文数量: 101
  • 博客积分: 2207
  • 博客等级: 大尉
  • 技术积分: 2508
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-19 20:45
文章分类

全部博文(101)

文章存档

2013年(15)

2012年(86)

我的朋友

分类: LINUX

2012-08-18 14:53:30

我总是自我良好一阵,后来仔细一看,我的水平真是相当烂啊
帖点我写的垃圾脚本,主要是shell里面的运算有好几种方式,今天时间不够了,有时间好好看看书强化下shell,awk和sed

点击(此处)折叠或打开

  1. #read.sh
  2. #!/bin/bash
  3. num=$1
  4. d=$((num * num))
  5. echo $d

  6. #square.sh
  7. #!/bin/bash
  8. #This is a example3
  9. int=1
  10. while test $int -le 10
  11. do
  12.     sq=$((int * int))
  13. echo $sq
  14. int=$((int+1))
  15. done
  16. #end

  17. #!/bin/bash
  18. mysql -uroot -pyesg -e "select Uin from test.UinTable" > 1.txt
  19. cat 1.txt | while read num
  20. do
  21. if [ $num != "Uin" ]
  22. then
  23.     ./read.sh $num
  24. fi
  25. done
  26. #end
当然还可以这样写

点击(此处)折叠或打开

  1. #read.sh
  2. #!/bin/bash
  3. num=$1
  4. nua=$2
  5. let "d=$num * $nua"
  6. echo $d

  7. #square.sh
  8. #!/bin/bash
  9. #This is a example3
  10. int=1
  11. while test $int -le 10
  12. do
  13.         let "sq = $int * $int"
  14.         echo $sq
  15.         let "int = $int + 1"
  16. done

这些东西都相当简单,主要是我太菜了,决定每天总结些东西让自己变的强大起来
阅读(957) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~