分页: 1 / 1

shell基础教程上到按照方法运行无法得到哦相应到结果

发表于 : 2011-02-27 22:06
晦月影
echo "this is the ${num}nd"
let "var+=1"
var=$[$var+1]
var=`expr $var + 1`
就是这个了..

antsilence@ubuntu:~$ ./first
antsilence@ubuntu:~$
这是结果..那里出现了错误?

Re: shell基础教程上到按照方法运行无法得到哦相应到结果

发表于 : 2011-02-27 22:20
枫叶饭团

代码: 全选

[maple@maple Desktop]$ chmod +x first.sh 
[maple@maple Desktop]$ ./first.sh 
this is the nd
[maple@maple Desktop]$ 

Re: shell基础教程上到按照方法运行无法得到哦相应到结果

发表于 : 2011-02-27 22:36
晦月影
枫叶饭团 写了:

代码: 全选

[maple@maple Desktop]$ chmod +x first.sh 
[maple@maple Desktop]$ ./first.sh 
this is the nd
[maple@maple Desktop]$ 
需要加.sh?
我开头是#!/bin/bash

Re: shell基础教程上到按照方法运行无法得到哦相应到结果

发表于 : 2011-02-27 23:15
枫叶饭团
#!/bin/bash
.sh是我一不小心习惯性的加上的。。。