shell programming problems (xv)

topic:

  Copy file movement, there m1.txt m2.txt m3.txt m4.txt, respectively, to create the corresponding directory, m1 m2 m3 m4 and move the file to the corresponding directory.

answer:  

#!/bin/bash

touch m1.txt m2.txt m3.txt m4.txt

I=1

while [ $I -le 4 ]; do
    mkdir m$I
    mv m$I.txt m$I
    I=$((I+1))
done

Guess you like

Origin www.cnblogs.com/wanghao-boke/p/12149042.html