ChinaUnix.net
相关文章推荐:

shell 使用ssh判断文件不存在

如果/tmp下存在result开头的文本文件(如result_var_log.txt)则备份为result_var_log.bak(其他类似),如果不存在则直接将data的结果写入到该文件。 当前主要有两个疑问,一个是如何判断文件是否存在,另外判断是文本文件

by djzhangxing - Linux新手园地 - 2014-05-25 18:04:52 阅读(1128) 回复(6)

相关讨论

shell怎么判断一个文件存在不存在??

by 231053469 - Shell - 2012-03-07 18:39:47 阅读(20002) 回复(8)

例如:判断存在时是用[-f XXX.txt]

by 编程序了没 - Shell - 2013-11-14 16:44:25 阅读(2400) 回复(5)

[code] if [ -d "/home/logs/" ] then echo "yes"; else mkdir -p -m 777 "/home/logs/" fi [/code] 我想省去then echo "yes"; 这一部。 我想如果目录不存在,就新建个目录.

by 我要思考 - Shell - 2007-12-24 10:01:37 阅读(17790) 回复(6)

如何用shell脚本判断ssh已经配置了密钥认证?求大神指点。

by 稻草人萤火虫 - Shell - 2013-09-23 09:35:16 阅读(3729) 回复(6)

#!/bin/sh for x in `cat ipfile` do filedir=$(ssh -lroot 10.0.1.$x ls /etc/cron.d/Z*) if [ -f $filedir ]; then ssh -lroot 10.0.1.$x "(sed -e 's/^/#/g' $filedir > ./tmp&& \ cat ./tmp > $filedir)" fi done 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/17797/showart_104111.html

by shone - Linux文档专区 - 2006-04-24 12:44:34 阅读(748) 回复(0)

请教各位大虾: 问题:使用ssh Client(ssh Secure shell)无法正常使用Public_key登录 客户端软件 :ssh Secure shell 3.29 服务器端Linux: Fedora6 (sshd_config默认配置) 客户端使用软件生成2048 RSA 文件上传到服务器 .ssh/ 并改名为authorized_keys 使用客户端连接提示如下图错误: 以下为sshd_config文件内容:(基本为默认设置) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #Port 22 #P...

by qmailer - Linux系统管理 - 2008-07-08 12:27:11 阅读(6010) 回复(6)

本帖最后由 prcardin 于 2014-03-05 16:40 编辑 shell判断本机能否ssh登陆批量远程服务器? 账号、密码:root/rootroot 这样的脚本怎么入手呢 比如脚本里对ip进行循环执行ssh命令时,到了输入密码这一步,立马退出,判断这台服务器是能够ssh登陆的,然后就这些服务器的ip写到一个文件里 # ssh -p22 192.168.6.56 -lroot Keyboard-interactive: PAM authentication Password: 需要输入密码时立即退出,将ip写到可以登陆的ip列...

by prcardin - Shell - 2014-03-05 16:52:29 阅读(2835) 回复(7)

[code]#!/bin/sh FILE_PATH=/u02/dbback/ebsdb cd $FILE_PATH[/code][quote] # sh archive_to_tape.sh : No such file or directory cd: /u02/dbback/ebsdb #. archive_to_tape.sh : No such file or directoryb [/quote] 路径确定是正确的。 类似写法在AIX上可以正常执行。求解,谢谢。

by faceDragon - Linux系统管理 - 2010-11-18 16:06:56 阅读(3916) 回复(3)

大家好,刚安装好FB的时候把root默认的shell更改为了 /usr/local/bi/bash(我使用ports安装了bash shell),昨天看到文章说最好不要更改root 默认shell,我就想改回去. # cshsh 编辑shell 到/bin/tcsh 当时由于不小心没有去掉/usr/,现在的shell 为/usr/bin/tcsh,当使用root登陆或su时,系统提士 /usr/bin/tcsh no such file or directory,重启到单用户 ,使用chsh 更改shell完毕,在vi编辑中:wq存盘退出时系统提示 chsh: entry inconsist...

by robin158 - BSD - 2005-03-12 16:47:25 阅读(1969) 回复(8)

shell文件存在的判断 shell数组 收藏 判断文件: WORKDIR=/home/tmp LOCAL_LIST_FILE=$WORKDIR/local.list #if no local.txt file, generate a new one if [ ! -f "$LOCAL_LIST_FILE" ]; then touch $LOCAL_LIST_FILE fi 注意:一定要有空格,判断文件是否存在,如果不存在,就生成一个新的 if [ ! -d /mnt ] # be sure the directory /mnt exists then mkdir...

by Rockenwind - Linux文档专区 - 2009-08-10 16:19:33 阅读(914) 回复(0)