fun()
{
#创建目录Test1和Test2
mkdir /work/Study/Test1
mkdir /work/Study/Test2
#通过mount命令将Test1绑定挂载在test2上
mount --bind /work/Study/Test1 /work/Study/Test2
#通过touch命令生成1.txt和2.txt文件
touch /work/Study/Test1/1.txt
touch /work/Study/Test1/2.txt
#实现输入两个数,将之间的值输入到1.txt,将1.txt的内容复制到2.txt,再追加逆序到2.txt上面
read min; read max;
while [ $min -ge $max ]
do
echo "shuru max"
read max
done
for (( i= $min; i <= $max; i++ ))
do
echo -n "$i "
done > /work/Study/Test1/1.txt
cat /work/Study/Test1/1.txt > /work/Study/Test1/2.txt
echo "" >> /work/Study/Test1/2.txt
for (( i=$max; i >= $min; i--))
do
echo -n "$i "
done >> /work/Study/Test1/2.txt
#打印2.txt的内容
cat /work/Study/Test1/2.txt
#输出test2的所有文件
ls -a /work/Study/Test2
#取消目录绑定,并删除Test1和Test2
rm -rf /work/Study/Test1
umount -l /work/Study/Test2
rm -rf /work/Study/Test2
}