zoukankan      html  css  js  c++  java
  • shell脚本

    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
         
     }

  • 相关阅读:
    按需导入NavMenu无法使用情况解决办法
    如果要使用另一台电脑作为服务器,注意关掉防火墙
    mongoose学习
    koa2的学习
    vue中swiper的使用
    447. Number of Boomerangs
    33. Search in Rotated Sorted Array
    461. Hamming Distance
    392. Is Subsequence
    412. Fizz Buzz
  • 原文地址:https://www.cnblogs.com/hqu-ye/p/3604508.html
Copyright © 2011-2022 走看看