微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

linux – 我怎么知道我使用的是哪个shell?

我正在写一个 shell脚本.我正在阅读的教程有第一行,如下所示:

#!/usr/bin/env bash /

但它不适合我. (错误:没有这样的目录)

我怎样才能知道我正在使用哪个bash以及它位于何处?

感谢任何建议和帮助.

非常感谢.它现在有效.

解决方案是#!/usr/bin/env bash

一个问题:为什么它只是无法读取’重启’这个词

我的代码在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 :)

解决方法

您可以尝试以下命令
which bash

一个壳.然后把

#!<the output of which bash>

原文地址:https://www.jb51.cc/linux/396589.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐