简体   繁体   中英

Bash Script: Perform certain actions on files of certain extension inside a certain directory?

我如何编写一个Bash脚本,它将选择~/test所有带有.css扩展名的文件,因此我可以将它们一个接一个地.css给其他操作?

#!/bin/bash
for f in ~/test/*.css
do
# your command 'cmd'
   cmd "$f"
done

To process a command for every .css files in one line, try like this:

find ~/test -type f -name '*.css' -execdir cmd {} \+

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM