Write a small script two days ago

xiaoxiao2021-03-06  95

After reading a long time, I only had a chance to calm down. Two days ago, I also seek a simple script: self-replicate file 00, and the file item name is accumulated, such as 01, 02, 03. . . . . . . . . Unture 99

After turning over a book, I wrote a simple script and experimented this feature.

#! / bin / bash

X = 0

Y = 0

While [$ x -lt 10]

DO

While [$ y -lt 9]

DO

CP $ x $ y $ x`Xpr $ y 1`

Y = `expr $ y 1`

DONE

X = `expr $ x 1`

Y = 0

CP 00 $ x $ y

DONE

Although it has achieved the desirable note, this script is really rough, at the same time, online friends have also sent a script, watching design ideas, I feel better than me:

#! / bin / bash

i = 1

While $ (TEST $ i -LE 9)

DO

CP ABC 0 $ I.ABC

i = $ (expr $ i 1)

DONE

While $ (TEST $ i -le 100)

DO

CP ABC $ I.ABC

i = $ (expr $ i 1)

DONE

转载请注明原文地址:https://www.9cbs.com/read-104245.html

New Post(0)