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

你可能感兴趣的文章
python | nupic,一个强大的 处理时间序列的Python 库!
查看>>
python | orange3,一个神奇的 Python 库!
查看>>
python | pdfminer,一个神奇的 关于PDF 文件的 Python 库!
查看>>
python | pendulum,一个有趣的 日期和时间 Python 库!
查看>>
python | pluginbase,一个神奇的 关于插件框架 的Python 库!
查看>>
python | ply,一个无敌的 词法和语法分析工具 的Python 库!
查看>>
python | py2exe,一个超酷的 Python 库!
查看>>
python | pyautogui,一个超酷的 Python 库!
查看>>
python | pybaobabdt,一个超强的 决策树可视化 Python 库!
查看>>
python | pycco,一个神奇的 Python 库!
查看>>
python | pyg2plot,一个有趣的 数据可视化 Python 库!
查看>>
python | pymc,一个超强的 Python 库!
查看>>
python | pynsist,一个强大的 Python 库!
查看>>
python | pyparsing,一个强大的 Python 库!
查看>>
python | pyqtgraph,一个神奇的 Python 库!
查看>>
python读取文本文件数据
查看>>
python | Python mock对象与测试替身
查看>>
python | Python pandas实现数据追加和合并的最佳方法
查看>>
python | Python 中检查一个数字是否是三态数
查看>>
python | Python 蒙特卡洛模拟
查看>>