shell编程代码 列出目录内所有文件并获取文件后缀
#!/bin/bash
列出当前目录内所有文件
for file in * do
如果是文件而不是目录
if [ -f "$file" ] then # 获取文件后缀 extension=${file##*.} echo "$file 的后缀是 $extension" fi done
原文地址: https://www.cveoy.top/t/topic/hiv0 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
#!/bin/bash
for file in * do
if [ -f "$file" ] then # 获取文件后缀 extension=${file##*.} echo "$file 的后缀是 $extension" fi done
原文地址: https://www.cveoy.top/t/topic/hiv0 著作权归作者所有。请勿转载和采集!