博客
关于我
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/

你可能感兴趣的文章
No qualifying bean of type XXX found for dependency XXX.
查看>>
No resource identifier found for attribute 'srcCompat' in package的解决办法
查看>>
Node.js 文件系统的各种用法和常见场景
查看>>
node.js 配置首页打开页面
查看>>
node.js+react写的一个登录注册 demo测试
查看>>
Node.js安装与配置指南:轻松启航您的JavaScript服务器之旅
查看>>
nodejs libararies
查看>>
nodejs-mime类型
查看>>
nodejs中Express 路由统一设置缓存的小技巧
查看>>
Node入门之创建第一个HelloNode
查看>>
NotImplementedError: Cannot copy out of meta tensor; no data! Please use torch.nn.Module.to_empty()
查看>>
npm run build 失败Compiler server unexpectedly exited with code: null and signal: SIGBUS
查看>>
npm WARN deprecated core-js@2.6.12 core-js@<3.3 is no longer maintained and not recommended for usa
查看>>
npm和yarn的使用对比
查看>>
npm报错unable to access ‘https://github.com/sohee-lee7/Squire.git/‘
查看>>
npm的问题:config global `--global`, `--local` are deprecated. Use `--location=global` instead 的解决办法
查看>>
NR,NF,FNR
查看>>
nrf开发笔记一开发软件
查看>>
NSDateFormatter的替代方法
查看>>
NSOperation基本操作
查看>>