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

全部博文(1148)

文章存档

2012年(15)

2011年(1078)

2010年(58)

分类: Python/Ruby

2011-01-19 15:40:24

$(command) 使用

$(command)的输出就是其中命令的输出

  1. #!/bin/sh

  2. echo the current directory $PWD
  3. echo the current users are $(who)

  4. exit 0



1.算术扩张

$((...)), 把你准备求值的表达式扩在 $((...)) 中能够更有效的完成简单的算数运算
  1. #!/bin/sh

  2. x=0
  3. while [ "$x" -ne 10 ]
  4. do
  5.     echo $x
  6.     x=$(($x+1))

  7. done

  8. exit 0


2.参数扩展

  1. #!/bin/sh

  2. for i in 1 2
  3. do
  4.     my_secret_passcess ${i}_tmp #注意 不能写成 $i_tmp,否则出错
  5. done





。。。。。。。。还有很多。。。。




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