[ $? -eq 0 ] && echo '成功' || echo '失败'
[root@centos~]# ls
anaconda-ks.cfg install.log install.log.syslog rpmbuild
[root@centos~]# [ $? -eq 0 ] && echo '成功' || echo '失败'
成功
[root@centos~]# lsss
-bash: lsss: command not found
[root@centos~]# [ $? -eq 0 ] && echo '成功' || echo '失败'
失败
[root@centos~]#