#!/bin/bash
rm -rf folder
mkdir folder
for((i=0; i<10; i++));
do
foldername=folder/folder$i
if [ ! -d $foldername ]; then
mkdir $foldername
fi
for((j=0; j<10; j++));
do
echo "this is file test foler${i} file${j}" >> folder/folder${i}/folder${i}_file${j}.txt
echo "this is file test2 foler${i} file${j}" >> folder/folder${i}/folder${i}_file${j}.txt
echo "this is file test3 foler${i} file${j}" >> folder/folder${i}/folder${i}_file${j}.txt
done
done
ls folder/ >folderslist.txt
folders_name_list=`cat folderslist.txt`
echo $folders_name_list
folder_array=(${folders_name_list// /} )
for folder_name in ${folder_array[@]}
do
echo $folder_name
done
searchresult=`find ./ -name folder1_file2.txt`
echo $searchresult
#grepresult=`grep -rn "this is file test2 foler" $searchresult`
#echo $grepresult
shell
最新推荐文章于 2024-05-21 14:11:17 发布