我正在编写一个shell脚本。我正在阅读的教程第一行是这样的:
#!/usr/bin/env bash/
,但它对我不起作用(错误: 没有这个目录
)。我该如何找出我正在使用哪个bash以及它的位置在哪里?感谢任何建议和帮助。非常感谢。现在它可以正常工作了。解决方案是#!/usr/bin/env bash
。另一个问题:为什么它只能读取单词“restart”?我的start.sh代码如下:#!/usr/bin/env bash/
RESTART="apachectl restart"
$RESTART
它不能工作。
Usage: /usr/local/apache2/bin/httpd [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-k start|restart|graceful|graceful-stop|sto p]
[-v] [-V] [-h] [-l] [-L] [-t] [-S]
Options:
-D name : define a name for use in <IfDefine name> directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C "directive" : process directive before reading config files
-c "directive" : process directive after reading config files
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-t -D DUMP_VHOSTS : show parsed settings (currently only vhost settings)
-S : a synonym for -t -D DUMP_VHOSTS
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t : run syntax check for config files
为什么会这样呢?它似乎可以读取“重新启动”这个词。
谢谢大家!现在我已经解决了。
解决方案:在Unix中编辑文件(使用vim / nano等,但不要在Windows中编辑)。
Thank again :)