Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4235707
  • 博文数量: 1148
  • 博客积分: 25453
  • 博客等级: 上将
  • 技术积分: 11949
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-06 21:14
文章分类

全部博文(1148)

文章存档

2012年(15)

2011年(1078)

2010年(58)

分类: Python/Ruby

2011-05-24 16:11:41


  1. #! /bin/bash

  2. echo -n "word 1:"
  3. read word1
  4. echo -n "word 2:"
  5. read word2

  6. if [ "$word1" == "$word2" ]
  7. then
  8. echo "match"
  9. else
  10. echo "no match"
  11. fi

  12. echo "end of program"
  1. ywx@yuweixian:~/yu/linux_command_vim_shell/bash$ ./if1
  2. word 1:yu
  3. word 2:yu
  4. match

  1. #! /bin/bash

  2. for fruit in apple orange pear banana
  3. do
  4.         echo "$fruit"
  5. done

  6. echo "finish"
  1. ywx@yuweixian:~/yu/linux_command_vim_shell/bash$ ./fruit2
  2. apple
  3. orange
  4. pear
  5. banana
  6. finish

  1. #! /bin/bash

  2. for arg
  3. do
  4.         echo "$arg"
  5. done

  6. echo "finish"
  1. ywx@yuweixian:~/yu/linux_command_vim_shell/bash$ ./for3 tek yu weixian
  2. tek
  3. yu
  4. weixian
  5. finish

  1. #! /bin/bash

  2. number=0
  3. while [ "$number" -lt 10 ]
  4. do
  5.         echo -n "$number"
  6.         ((number +=1))
  7. done

  8. echo
  1. ywx@yuweixian:~/yu/linux_command_vim_shell/bash$ ./count4
  2. 0123456789



















阅读(1071) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~