全球主机交流论坛

标题: 求助。。。为什么sh无法运行? [打印本页]

作者: Rey    时间: 2011-4-7 20:05
提示: 作者被禁止或删除 内容自动屏蔽
作者: yaoe    时间: 2011-4-7 20:17
换行...unix格式
作者: Rey    时间: 2011-4-7 20:21
提示: 作者被禁止或删除 内容自动屏蔽
作者: server    时间: 2011-4-7 20:29
[root@server /]# sh ./i.sh start
starting apache
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using ..... for ServerName
                                                           [  OK  ]
作者: server    时间: 2011-4-7 20:30
#!/bin/sh
start(){
  echo starting apache
  service httpd start
};
stop() {
  echo stoping apache
  service httpd stop
};
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
   stop
   start
   ;;
esac
语法错误。

[ 本帖最后由 server 于 2011-4-7 20:31 编辑 ]
作者: Rey    时间: 2011-4-7 20:31
提示: 作者被禁止或删除 内容自动屏蔽
作者: yaoe    时间: 2011-4-7 20:34
标题: 回复 3# 的帖子
你确定你真的明白我说什么吗?
附件压缩包含有2个不同换行的sh文件,执行下你就懂了
作者: Rey    时间: 2011-4-7 20:45
提示: 作者被禁止或删除 内容自动屏蔽
作者: yaoe    时间: 2011-4-7 20:47
标题: 回复 8# 的帖子
2楼我就说了真相了.你就是不信.

作者: johnnyfu829    时间: 2011-4-7 20:52
如果是在windows写的,然后上传的,用dos2unix命令转换下格式,就像2L说的,windows下和linux下的换行符号是不一样的
作者: Rey    时间: 2011-4-7 20:52
提示: 作者被禁止或删除 内容自动屏蔽
作者: Porter    时间: 2011-4-7 21:00
apachectl本身就是个脚本,为什么又套了一层?
作者: whyyyhk    时间: 2011-4-7 21:06
提示: 作者被禁止或删除 内容自动屏蔽
作者: johnnyfu829    时间: 2011-4-7 21:14
原帖由 whyyyhk 于 2011-4-7 21:06 发表
notepad++在編輯>檔案格式轉換
可選unix

话说notepad++还没用过呢
作者: Poison    时间: 2011-4-7 21:39
;
作者: whyyyhk    时间: 2011-4-7 21:48
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 全球主机交流论坛 (https://lilynana.eu.org/) Powered by Discuz! X3.4