1 2 3 4 5 6 7 8 9 10 11 12 13 |
#!/bin/bash #fuck the one who yell to me today count=1 for img in *.jpg *.png do new=image-$count.${img##*.} mv "$img" "$new" 2>/dev/null if [ $? eq 0 ];then echo "Renaming $img to $new" let count++ fi done |
关于取后缀的部分,如下例子
URL=”www.google.com”
echo ${URL%.*} www.google
echo ${URL%%.*} www
echo ${URL#*.} google.com
echo ${URL##*.} com
时间:2012-12-13 21:40:41
Latest posts by Zhiming Zhang (see all)
- aws eks node 自动化扩展工具 Karpenter - 8月 10, 2022
- ReplicationController and ReplicaSet in Kubernetes - 12月 20, 2021
- public key fingerprint - 5月 27, 2021