Skip to content

docs(variable): fix error#62

Closed
CyrusYip wants to merge 1 commit intowangdoc:masterfrom
CyrusYip:patch-1
Closed

docs(variable): fix error#62
CyrusYip wants to merge 1 commit intowangdoc:masterfrom
CyrusYip:patch-1

Conversation

@CyrusYip
Copy link
Contributor

ls 文件不存在返回值为 2,测试代码:

❯ docker run -i -t --rm ubuntu
root@5e697f8da527:/# echo $0
bash
root@5e697f8da527:/# ls sssssssssssssssss
ls: cannot access 'sssssssssssssssss': No such file or directory
root@5e697f8da527:/# echo $?
2
root@5e697f8da527:/# bash --version
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)

Screenshot_20211023_160929

`ls` 文件不存在返回值为 2,测试代码:

```bash
❯ docker run -i -t --rm ubuntu
root@5e697f8da527:/# echo $0
bash
root@5e697f8da527:/# ls sssssssssssssssss
ls: cannot access 'sssssssssssssssss': No such file or directory
root@5e697f8da527:/# echo $?
2
root@5e697f8da527:/# bash --version
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
```
@ruanyf
Copy link
Contributor

ruanyf commented Oct 23, 2021

操作失败时,返回一个非零值,大多数系统是1。

@ruanyf ruanyf closed this Oct 23, 2021
@CyrusYip
Copy link
Contributor Author

@ruanyf 请问什么系统返回 1 的?可以举些例子吗?

@zackzhangkai
Copy link

@CyrusYip 比如mac就返回1

@CyrusYip
Copy link
Contributor Author

@zackzhangkai 多谢告知!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants