`ls` 退出状态

发布于 2024-07-25 01:29:29 字数 200 浏览 3 评论 0原文

编辑:这里没什么可看的! 127 return 意味着找不到命令 - 由于某种原因必须给出命令的绝对路径:/(我没有删除,以防其他人遇到这个问题)

是否有常见 Linux 函数的返回状态参考,例如ls? (它似乎不在手册页中,至少对于ls)。 如果没有,有人可以告诉我 ls 返回 127 是什么意思吗?

EDIT: nothing to see here!!!
127 return means the command wasn't found - had to give an absolute path to the command for some reason :/ (I didn't delete in case someone else has this problem)

Is there a reference of return statuses for common Linux functions like ls? (it doesn't seem to be in the man pages, at least for ls). If not, can someone tell me what ls returning 127 means?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

情丝乱 2024-08-01 01:29:30

127 是未找到命令的错误。 在这种情况下,我只需使用命令的绝对路径 (/bin/ls)

127 is the error for command not found. In this case, I just had to use an absolute path to the command (/bin/ls)

獨角戲 2024-08-01 01:29:30

根据 http://www.opengroup.org/onlinepubs/009695399/utilities/ ls.html 返回值0表示成功,任何>0都是错误

as per http://www.opengroup.org/onlinepubs/009695399/utilities/ls.html a return value of 0 means success, anything >0 is an error

北笙凉宸 2024-08-01 01:29:30

ls 不是 Bash 函数。 它是一个外部实用程序。 在 Linux 上,ls 是 GNU 文件实用程序的一部分。 man ls 应该显示与 http://www.gnu.org/software/coreutils/manual/html_node/ls-invocation.html,其中退出状态的唯一可能值定义为 0、1 和 2。

ls is not a Bash function. It is an external utility. On Linux, ls is part of the GNU File Utilities. man ls should show you similar information as http://www.gnu.org/software/coreutils/manual/html_node/ls-invocation.html where the only possible values for its exit status are defined as 0, 1 and 2.

前事休说 2024-08-01 01:29:30

for ls: “如果正常则退出状态为 0,如果有小问题则为 1,如果有严重问题则为 2。”

资料来源: UNIX 手册页:ls

我怀疑你找到这个的选择出来的一般是:

  1. man
  2. Google
  3. 源码分析

for ls: "Exit status is 0 if OK, 1 if minor problems, 2 if serious trouble."

Source: UNIX man pages : ls

I suspect your options to find this out generally are:

  1. man
  2. Google
  3. source code analysis
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文