[[email protected] ~]$ [ "$(id -u)" -eq "0" ] && echo you are root || echo you must be root
you must be root
[[email protected] ~]$ id -u
501
==========================
&& 与符号
|| 或符号
&&如果前面的命令执行成功则执行&&后的命令否则执行||后面的命令
时间: 2024-10-07 13:49:57
[[email protected] ~]$ [ "$(id -u)" -eq "0" ] && echo you are root || echo you must be root
you must be root
[[email protected] ~]$ id -u
501
==========================
&& 与符号
|| 或符号
&&如果前面的命令执行成功则执行&&后的命令否则执行||后面的命令