如题所述
第1个回答 2017-04-05
脚本1:
#!/bin/bash
#
#
cd /tmp/script
cfile=` find -name '*.c' `
hfile=` find -name '*.h' `
for fc in $cfile
do
cfname=`basename -s .c $fc`
cat $fc >/tmp/scripttest/$cfname.txt
done
for fh in $hfile
do
cp $fh /tmp/scripttest
done本回答被网友采纳
#!/bin/bash
#
#
cd /tmp/script
cfile=` find -name '*.c' `
hfile=` find -name '*.h' `
for fc in $cfile
do
cfname=`basename -s .c $fc`
cat $fc >/tmp/scripttest/$cfname.txt
done
for fh in $hfile
do
cp $fh /tmp/scripttest
done本回答被网友采纳
第2个回答 2017-01-22
#!/bin/bash
while true
do
if [ -f /root/*.warming ];then
cp /root/xxx.conf /tmp
fi
done
while true
do
if [ -f /root/*.warming ];then
cp /root/xxx.conf /tmp
fi
done
第3个回答 2019-07-02
搜一下:如何用shell脚本遍历指定目录下的文件,并按后缀名分类