用shell写一个脚本按日期循环执行某一条命令怎么写

2024-12-30 21:18:39
推荐回答(1个)
回答1:

[ $? -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~]#