shell脚本检测是否有安装rsync

2025-06-28 09:20:48
推荐回答(1个)
回答1:

[root@iZ259r7h4pfZ ~]# whereis rsync
rsync: /usr/bin/rsync /usr/share/man/man1/rsync.1.gz
[root@iZ259r7h4pfZ ~]# whereis rs
rs:
如果安装了,冒号后面是有的
所以判断下
if [ `whereis rsync|awk -F: '{print $2"x"}'|sed "s/ //g"` = "x" ];then echo no rsync ;else echo rsync installed;fi