=====Linux下检测服务器上指定文件是否存在===== #!/bin/bash name=$1 ssh_host="10.10.10.10" file="/var/www/domain.io/static/img/"$name if ssh $ssh_host test -e $file; then echo $ssh_host $file exists! else echo $ssh_host $file DOES NOT EXIST! fi ssh_host="11.11.11.11" file="/var/www/domain.io/static/img/"$name if ssh $ssh_host test -e $file; then echo $ssh_host $file exists! else echo $ssh_host $file DOES NOT EXIST! fi