#Bash 的 false 命令
false OPTION
功能
什么也不做,直接返回失败(1),通常用于 if 语句。
类型
Bash 内置命令。
false也是 coreutils 的一个可执行文件;为了保持 POSIX 标准的兼容性,确保在其他 shell(比如一些极简的或古老的 shell)或者某些特定环境下,命令依然可用。
参数
OPTION选项:--help- 显示帮助--version- 显示版本
#示例
if [ false ]; then
echo 吃饭
else
echo 睡觉
fi
#相关命令
#推荐阅读
#手册
FALSE(1) User Commands FALSE(1) NAME false - do nothing, unsuccessfully SYNOPSIS false [ignored command line arguments] false OPTION DESCRIPTION Exit with a status code indicating failure. --help display this help and exit --version output version information and exit NOTE: your shell may have its own version of false, which usually su‐ persedes the version described here. Please refer to your shell's doc‐ umentation for details about the options it supports. AUTHOR Written by Jim Meyering. REPORTING BUGS GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Report any translation bugs to <https://translationproject.org/team/> COPYRIGHT Copyright © 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO Full documentation <https://www.gnu.org/software/coreutils/false> or available locally via: info '(coreutils) false invocation' GNU coreutils 9.4 April 2024 FALSE(1)