当前位置:网站首页>Shell常用脚本:判断远程主机的文件是否存在
Shell常用脚本:判断远程主机的文件是否存在
2022-07-25 12:41:00 【嗯嗯**】
remoteFileTest.sh
#/bin/bash
# 使用此脚本前必须在本机运行 【ssh-keygen】生成公私密钥文件,然后用【ssh-copy-id -i 本机公钥文件 远程用户名@远程IP】将本机公钥给远程主机
#
remoteIp=$1
remoteFile=$2
echo "入参1:${remoteIp}"
echo "入参2:${remoteFile}"
if [[ -n ${remoteIp} && -n ${remoteFile} ]]; then
if (ssh [email protected]${remoteIp} test -e ${remoteFile});then
echo "存在文件${remoteFile}在远程主机${remoteIp}中"
else
echo "不存在文件${remoteFile}在远程主机${remoteIp}中"
fi
else
echo "用法: sh $0 远程主机IP 远程主机文件的绝对路径"
fi

边栏推荐
- Excuse me, using data integration to import data from PostgreSQL to MySQL database, emoj appears in some data fields
- 论文解读(MaskGAE)《MaskGAE: Masked Graph Modeling Meets Graph Autoencoders》
- [operation and maintenance, implementation of high-quality products] interview skills for technical positions with a monthly salary of 10k+
- Synergetic process
- Selenium uses -- XPath and analog input and analog click collaboration
- If you want to do a good job in software testing, you can first understand ast, SCA and penetration testing
- “蔚来杯“2022牛客暑期多校训练营2 补题题解(G、J、K、L)
- 如何理解Keras中的指标Metrics
- 零基础学习CANoe Panel(15)—— 文本输出(CAPL Output View )
- Zero basic learning canoe panel (16) -- clock control/panel control/start stop control/tab control
猜你喜欢

交换机链路聚合详解【华为eNSP】

想要白嫖正则大全是吧?这一次给你个够!

If you want to do a good job in software testing, you can first understand ast, SCA and penetration testing
![[advanced C language] dynamic memory management](/img/b7/6586b35500eb8f39a3ea8c125fb572.png)
[advanced C language] dynamic memory management

More accurate and efficient segmentation of organs-at-risk in radiotherapy with Convolutional Neural

Selenium use -- installation and testing

艰辛的旅程

阿里云技术专家秦隆:可靠性保障必备——云上如何进行混沌工程?

零基础学习CANoe Panel(14)——二极管( LED Control )和液晶屏(LCD Control)

yum和vim须掌握的常用操作
随机推荐
软件测试面试题目:请你列举几个物品的测试方法怎么说?
Fiddler packet capturing app
MySQL remote connection permission error 1045 problem
Synergetic process
[operation and maintenance, implementation of high-quality products] interview skills for technical positions with a monthly salary of 10k+
阿里云技术专家秦隆:可靠性保障必备——云上如何进行混沌工程?
"Autobiography of Franklin" cultivation
2022 年中回顾 | 大模型技术最新进展 澜舟科技
Create directories and subdirectories circularly
Use of Spirng @conditional conditional conditional annotation
LeetCode 1184. 公交站间的距离
【历史上的今天】7 月 25 日:IBM 获得了第一项专利;Verizon 收购雅虎;亚马逊发布 Fire Phone
程序员奶爸自制AI喂奶检测仪,预判宝宝饿点,不让哭声影响老婆睡眠
迁移PaloAlto HA高可用防火墙到Panorama
go : gin 自定义日志输出格式
word样式和多级列表设置技巧(二)
Selenium uses -- XPath and analog input and analog click collaboration
The larger the convolution kernel, the stronger the performance? An interpretation of replknet model
Interviewer: "classmate, have you ever done a real landing project?"
艰辛的旅程