linux shell脚本 总报错sh11-2.sh: 9: Syntax error: "(" unexpected

linux shell脚本 总报错sh11-2.sh: 9: Syntax error: "(" unexpected,第1张

我直接复制你这个,直接运行,没有任何报错啊。

[flycat@redhat script]$ sh -x aaa.sh

+ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/home/flycat/bin

+ export PATH

+ echo 'Input your selection'

Input your selection

+ case $1 in

+ echo 'Usage {one|two|three}'

Usage {one|two|three}

[flycat@redhat script]$ chmod 755 aaa.sh

[flycat@redhat script]$ ./aaa.sh

Input your selection

Usage {one|two|three}

[flycat@redhat script]$ ./aaa.sh one

Input your selection

Your choice is ONE

[flycat@redhat script]$ ./aaa.sh two

Input your selection

Your choice is TWO

[flycat@redhat script]$ ./aaa.sh three

Input your selection

Your choice is THREE

command 2&>/dev/null #就不显示错误

command 1&>/dev/null 2&>/dev/null #取消所有输出

其中command是要调用的脚本,其后的内容不算作参数,被shell直接解析如果改成

command 2&>file

就会将错误重定向到file文件

首先查看日志信息,比如 less /var/log/apache2/error.log

找到出错的地方,其次,就你的问题,可能没有添加对perl脚本的支持,对perl脚本或者cgi的目录确保有下面的支持语句:# directory to store data for web browser viewing

AddHandler cgi-script .cgi

AddHandler cgi-script .pl

<Directory /var/www/cgi>

Options FollowSymLinks ExecCGI


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/7205504.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-02
下一篇2023-04-02

发表评论

登录后才能评论

评论列表(0条)

    保存