Mass production of random character filenames
Requirement: Use the For loop to create 10 batches of HTML in the/oldboy directory. Each of these files needs to contain 10 random lowercase letters plus a fixed string of Oldboy.
#!/bin/bash[!-d/oldboy] && mkdir/oldboycd/oldboyfor (i=0;i<10;i++) do aa= "' Echo $RANDOM | md5sum | Cut-c 1-11 ' "Touch" $AA "_oldboy.htmldone~
2. Batch Renaming
Change all of the above Oldboy to oldgirl (preferably with for) and change the extension to uppercase
#!/bin/bashcd/oldboyfor i in ' ls/oldboy ' do rename "Oldboy" "Oldgirl"/oldboy/$i rename "html" "HTML"/oldboy/$idone ~
3. Scan the surviving hosts in the network:
#!/bin/bashfor i in ' seq ten ' do ip=192.168.116. $i ping-w 5-c 2 $ip >/dev/null aa=$? If [$?-ne 0] Then echo ' This $ip are bad ... "else echo" This $ip is good ... "fidone~
Enterprise Shell interview Case (top)