博客
关于我
shell实例1
阅读量:654 次
发布时间:2019-03-15

本文共 527 字,大约阅读时间需要 1 分钟。

我需要在指定服务器的对应文件夹下下载对应文件名和文件大小的文件。文件地址位于192.168.1.4:5555/file下的文件目录。

使用wget工具进行下载操作,并将下载日志保存下来,日志文件名命名为m-i。每个文件夹下执行下载五次。脚本应位于/some/directory下,具体指向shell文件夹。

为了实现此功能,我需要编写一个适用于Linux的shell脚本。以下是实现方法:

#!/bin/bash

for file in find ../$dir -type d doif [[ $file == "shell" ]]; thencontinuefiecho $filecd ../$filefor ((i = 1; i <= limit; i++)); do# 填写实际的wget命令,这里示例内容wget http://示例地址/$file$name -O /path/to/output/$file$nameecho "下载完成:" $file$name >> m-i-$$idonedone

请确保将此脚本放置在指定的文件目录中,并根据实际需求调整相关路径和参数。记得赋予脚本执行权限:chmod +x scriptname.sh

转载地址:http://pxzmz.baihongyu.com/

你可能感兴趣的文章
php curl 实例+详解
查看>>
php curl_init函数用法(http://blog.sina.com.cn/s/blog_640738130100tsig.html)
查看>>
php curl_multi批量发送http请求
查看>>
php echo 输出 锘?... 乱码问题
查看>>
ReferenceQueue的使用
查看>>
php flush()刷新不能输出缓冲的原因分析
查看>>
Referenced classpath provider does not exist: org.maven.ide.eclipse.launchconfig
查看>>
Refactoring-Imporving the Design of Exsiting Code — 代码的坏味道
查看>>
PHP imap 远程命令执行漏洞复现(CVE-2018-19518)
查看>>
php include和require
查看>>
ref 和out 区别
查看>>
php JS 导出表格特殊处理
查看>>
php json dom解析
查看>>
ReentrantReadWriteLock读写锁解析
查看>>
php laravel实现依赖注入原理(反射机制)
查看>>
php laravel请求处理管道(装饰者模式)
查看>>
ReentrantReadWriteLock读写锁底层实现、StampLock详解
查看>>
PHP mongoDB 操作
查看>>
ReentrantLock读写锁
查看>>
ReentrantLock的公平锁与非公平锁
查看>>