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

sh/bash/dash/ksh/zsh等Shell脚本
回复
晦月影
帖子: 14
注册时间: 2011-02-26 16:14
联系:

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

#1

帖子 晦月影 » 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:~$
这是结果..那里出现了错误?
不知道为什么,就是喜欢去弄那些根本不可能明白的东西...没天才到脑子,但是有精神病般的思想
头像
枫叶饭团
帖子: 14683
注册时间: 2010-06-16 1:05
系统: Mac OS X
来自: Tencent
联系:

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

#2

帖子 枫叶饭团 » 2011-02-27 22:20

代码: 全选

[maple@maple Desktop]$ chmod +x first.sh 
[maple@maple Desktop]$ ./first.sh 
this is the nd
[maple@maple Desktop]$ 
晦月影
帖子: 14
注册时间: 2011-02-26 16:14
联系:

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

#3

帖子 晦月影 » 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
不知道为什么,就是喜欢去弄那些根本不可能明白的东西...没天才到脑子,但是有精神病般的思想
头像
枫叶饭团
帖子: 14683
注册时间: 2010-06-16 1:05
系统: Mac OS X
来自: Tencent
联系:

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

#4

帖子 枫叶饭团 » 2011-02-27 23:15

#!/bin/bash
.sh是我一不小心习惯性的加上的。。。
回复