我的shell脚本为什么执行不了

sh/bash/dash/ksh/zsh等Shell脚本
回复
头像
steven0lisa
帖子: 68
注册时间: 2008-01-31 11:57

我的shell脚本为什么执行不了

#1

帖子 steven0lisa » 2009-08-09 15:40

环境:ubuntu9.04
我看了论坛上的教程,写了一个helloworld

代码: 全选

#!/bin/sh
echo "你好"
为什么在终端中运行,说command not found :em20

这个文件我放在桌面上,为什么还要sudo 来运行?直接运行不行么? :em06

另外我想知道,我想双击直接运行它,不想在终端中运行,直接双击使用,不知道大家有什么好办法? :em02

有什么好的shell的IDE推荐阿? :em09
expipi
帖子: 27
注册时间: 2008-04-15 14:57
来自: sdust.B14.603

Re: 我的shell脚本为什么执行不了

#2

帖子 expipi » 2009-08-09 15:47

shell 目录cd到放置helloworld文件de目录下面,
输入

代码: 全选

./helloworld
leisure
帖子: 141
注册时间: 2008-05-03 16:43
联系:

Re: 我的shell脚本为什么执行不了

#3

帖子 leisure » 2009-08-09 17:00

command not found可能是你没有像楼上这样来运行,还有可能是你的那个shell脚本没有运行的权限。
expipi
帖子: 27
注册时间: 2008-04-15 14:57
来自: sdust.B14.603

Re: 我的shell脚本为什么执行不了

#4

帖子 expipi » 2009-08-09 17:47

切换到helloworld的目录下,修改权限:

代码: 全选

chmod 700  helloworld
头像
jioyo源
帖子: 3476
注册时间: 2008-10-08 13:48

Re: 我的shell脚本为什么执行不了

#5

帖子 jioyo源 » 2009-08-09 18:48

expipi 写了:shell 目录cd到放置helloworld文件de目录下面,
输入

代码: 全选

./helloworld
leisure 写了:command not found可能是你没有像楼上这样来运行,还有可能是你的那个shell脚本没有运行的权限。
--------------------------------------
论坛精华贴全集:http://forum.ubuntu.org.cn/viewtopic.php?f=48&t=199845
book:http://forum.ubuntu.org.cn/viewtopic.php?f=21&t=198286
头像
HuaChong
帖子: 493
注册时间: 2006-09-12 17:10

Re: 我的shell脚本为什么执行不了

#6

帖子 HuaChong » 2009-08-09 19:25

应该是没得权限的问题
头像
highwind
帖子: 1362
注册时间: 2008-09-05 23:31
系统: LinuxMint17

Re: 我的shell脚本为什么执行不了

#7

帖子 highwind » 2009-08-09 22:01

路径问题
权限问题
执行问题
:em20
impi
帖子: 3
注册时间: 2009-07-28 14:56

Re: 我的shell脚本为什么执行不了

#8

帖子 impi » 2009-08-12 17:54

chmod a+x 文件
头像
bones7456
帖子: 8495
注册时间: 2006-04-12 20:05
来自: 杭州
联系:

Re: 我的shell脚本为什么执行不了

#9

帖子 bones7456 » 2009-08-12 18:01

shell还要IDE啊。。。 :em20
关注我的blog: ε==3
头像
steven0lisa
帖子: 68
注册时间: 2008-01-31 11:57

Re: 我的shell脚本为什么执行不了

#10

帖子 steven0lisa » 2009-08-20 15:30

bones7456 写了:shell还要IDE啊。。。 :em20
习惯了有IDE的日子了...习惯了自动格式化代码的爽快感觉,呵呵 :em04
回复