遍历文件,批量操作
cat ./urlget.txt | while read myline
do
echo ${myline}
curl ${myline}
sleep 100
done
#!/bin/bash
ls *.jpg | while read one_line
do
echo ${one_line}
echo ${one_line##*-}
cp ${one_line} ${one_line##*-}
ffmpeg -i "${one_line}" -s 1920x1080 "${one_line}.png" -y
done
shell 字符串截取:
参考:https://www.cnblogs.com/fengbohello/p/5954895.html
循环打印
[root@localhost Test]# cat while.sh
#!/bin/bash
a=$1
while [ ${a} -ge 0 ]
do
echo "Current number is:" ${a}
a=$((a-1))
done
[root@localhost Test]# bash while.sh 5
Current number is: 5
Current number is: 4
Current number is: 3
Current number is: 2
Current number is: 1
Current number is: 0
这篇博客介绍了如何使用Shell脚本进行文件遍历和批量操作,包括从urlget.txt读取URL并执行curl命令,以及处理jpg图片文件,提取文件名后缀并进行拷贝和转换。此外,还讲解了Shell字符串截取技巧,通过示例展示了如何递减计数。
2578

被折叠的 条评论
为什么被折叠?



