编写一个shell程序,将文件的.txt后缀名删除的程序
答案一:
#!/bin/bash
for i in `ls *.txt`
do
p=`echo $i|awk -F. '{print $1}'`
mv $i $p
done
答案二:find -type f -name '*.txt' -print0 | xargs --null rename '.txt' ''
#!/bin/bash
for i in `ls *.txt`
do
p=`echo $i|awk -F. '{print $1}'`
mv $i $p
done
答案二:find -type f -name '*.txt' -print0 | xargs --null rename '.txt' ''
none