我正在写一个shell脚本.我正在阅读的教程有第一行,如下所示:
#!/usr/bin/env bash/
但它不适合我.(error : no such directory)
我怎样才能知道我正在使用哪个bash以及它位于何处?
感谢任何建议和帮助.
非常感谢.它现在有效.
解决方案是 #!/usr/bin/env bash
另一个问题:为什么它只是读不出'重启'这个词
我的代码在start.sh中:
#!/usr/bin/env bash/
RESTART="apachectl restart"
$RESTART
Run Code Online (Sandbox Code Playgroud)
我不工作.
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
Run Code Online (Sandbox Code Playgroud)
为什么会那样?它似乎可以读取重启一词.
谢谢你们!我现在修好了.
解决方案:在unix中编辑文件(vim/nano以及Windows中的任何内容)
Thank again :)
Run Code Online (Sandbox Code Playgroud)
您可以尝试以下命令
which bash
Run Code Online (Sandbox Code Playgroud)
在一个外壳。然后放
#!<the output of which bash>
Run Code Online (Sandbox Code Playgroud)