true

返回零(真)退出状态

语法:

  true

除了返回退出状态0,表示“成功”,“true”不执行任何操作。它可以在shell脚本中用作占位符,其中需要成功的命令,尽管shell内置命令:(冒号)可以更快地执行相同的操作。

`true’忽略所有命令行参数,甚至是–help和–version,因为否则会改变一些程序员可能依赖的预期行为。

这个版本的“true”是作为C程序实现的,因此比shell脚本实现更安全,更快,并且可以安全地用作虚拟shell以禁用帐户。

true 命令实例:

linux命令:true && { echo success;} || { echo failed; } } failed; echo { || success;} echo { && true true && { echo success;} || { echo failed; }rootopen.com
linux命令:true && { echo success;} || { echo failed; } } failed; echo { || success;} echo { && true true && { echo success;} || { echo failed; }rootopen.com
2018-05-23 19:01:48

linux命令:truecrypt volume.tc volume.tc truecrypt truecrypt volume.tcrootopen.com
linux命令:truecrypt volume.tc volume.tc truecrypt truecrypt volume.tcrootopen.com
2018-04-16 15:39:48

linux命令:true || false && echo true || echo false false echo || true echo && false || true true || false && echo true || echo falserootopen.com
linux命令:true || false && echo true || echo false false echo || true echo && false || true true || false && echo true || echo falserootopen.com
2018-01-28 19:18:48

linux命令:true | mailx -n -a MYTEXT.txt -r my@mail.com -s log -S smtp=mail.com -S smtp-auth-user=MYUSER -S smtp-auth-password=MYPASSWORD FRIEND@mail.com FRIEND@mail.com smtp-auth-password=MYPASSWORD -S smtp-auth-user=MYUSER -S smtp=mail.com -S log -s my@mail.com -r MYTEXT.txt -a -n mailx | true true | mailx -n -a MYTEXT.txt -r my@mail.com -s log -S smtp=mail.com -S smtp-auth-user=MYUSER -S smtp-auth-password=MYPASSWORD FRIEND@mail.comrootopen.com
linux命令:true | mailx -n -a MYTEXT.txt -r my@mail.com -s log -S smtp=mail.com -S smtp-auth-user=MYUSER -S smtp-auth-password=MYPASSWORD FRIEND@mail.com FRIEND@mail.com smtp-auth-password=MYPASSWORD -S smtp-auth-user=MYUSER -S smtp=mail.com -S log -s my@mail.com -r MYTEXT.txt -a -n mailx | true true | mailx -n -a MYTEXT.txt -r my@mail.com -s log -S smtp=mail.com -S smtp-auth-user=MYUSER -S smtp-auth-password=MYPASSWORD FRIEND@mail.comrootopen.com
2018-03-11 08:51:48

Linux的Bash命令行(A-Z排序)