法1:(1)脚本要有可执行权限;(2)执行时要使用命令的绝对路径(当前路径的话是./脚本名)[root@oldboy /]# cat /mnt/tar.sh #!/bin/shtar cfz /www_html_$(date +%w).tar.sh /var/www/html >/dev/null[root@oldboy ~]# ll /mnt/tar.sh -rwxr-xr-x 1 roo
功能:此脚本在root权限下通过expect结合shell的方法,可以非交互拷贝任何文件。优势:只需一个脚本轻松搞定密钥和密码且可以拷贝文件[root@localhost scr]# cat 6.sh #!/bin/shlocal_file=$1remote_dir=$2if [ $# -ne 2 ];then echo "usage:$0 argv2" echo "must two argv
Copyright © 2005-2024 51CTO.COM 版权所有 京ICP证060544号