我正在找到所有以.sh结尾的文件,但只需要显示文件名而不能显示./
(find -type f \( -name "*[.sh]" \) )
它也给了我所有以.sh结尾的文件,并且在子目录下:
./erj.sh
./another/r5.sh
./another/t9.sh
./another/rrr2.sh
./elro/2039jlfsdjf.sh
./elro/tlr.sh
./elro/823.sh
./222.sh
./my_find_sh
./rrr.sh
./4234.sh
./sdf.sh
但是使用“ cut -d。-f1”给我空的输出,因为它将第一个点作为删除点
find -type f \( -name "*[.sh]" \) | cut -d. -f1
给出空行。
尝试这个: