这样写为什么错了,,,呃呃呃bash刚刚接触一丢丢,轻点批
cd 'find ./ -name "%.txt" | sed -n "1p">a.out
本来想用for file in 路径
if 判断 文件是不是.txt
do 读取第一行 到a.out
done
但是总是报错,就是这样,,,,,
这样写为什么错了,,,呃呃呃bash刚刚接触一丢丢,轻点批
cd 'find ./ -name "%.txt" | sed -n "1p">a.out
本来想用for file in 路径
if 判断 文件是不是.txt
do 读取第一行 到a.out
done
但是总是报错,就是这样,,,,,
不好意思,格式错了。
#!/bin/bash
for f in `ls *.txt`
do
head -n 1 $f >> a.out
done