shell脚本入门 如何用shell脚本遍历指定目录下的文件,并按后缀名分类?

如何用shell脚本遍历指定目录下的文件,并按后缀名分类?脚本1:#!/bin/bash###cd/tmp/scriptcfile=`find-name“*.c”`hfile=`find-name“*

如何用shell脚本遍历指定目录下的文件,并按后缀名分类?

脚本1:#!/bin/bash###cd/tmp/scriptcfile=`find-name“*.c”`hfile=`find-name“*.h”`for$cfiledocfname=`basename-s.c$fc`cat$fc>/tmp/scripttest中的fc/$cfname.txtdonefor文件fh在$hfiledocp$fh/tmp/scripttestdone中