博客年龄:17年11个月
访问:?
文章:69篇

shell学习2

分类:linux
2010-10-07 20:26 阅读(?)评论(0)

     

三、         赋值拼字符串

vi second

#!/bin/sh

num=2

echo “this is $numnd”

echo “this is $num nd”

echo “this is {$num}nd”

echo “this is ${num}nd”

esc :x 回车

chmod +x second

./second

输出:

this is            //以为找不到numnd这个变量

this is 2 nd        //不用解释了吧

this is {2}nd       //错误用法

this is 2nd      //${num}与$num效果相同,拼字符串可以用前者

  最后修改于 2010-10-15 22:19    阅读(?)评论(0)
上一篇: 该日志被锁定 下一篇:shell学习1
 
表  情:
加载中...
 

请各位遵纪守法并注意语言文明