#!/bin/bash
for i in * # for every file in folder
do
# if file reports "ASCII text"
if file "$i" | grep --quiet 'ASCII text$'
then
# print filename
echo "$i"
fi
done
一个班轮:
$ for i in *; do if file "$i" | grep -q 'ASCII text$' ; then echo "$i"; fi; done
使用
file
命令:一个班轮: