shell指令碼,在指定目錄下通過隨機小寫10個字母加固定字串oldboy大量建立10個html檔案。

來源:互聯網
上載者:User

標籤:

[[email protected] wyb]# cat test10.sh #!/bin/bash#使用for迴圈在/test10目錄下通過隨機小寫10個字母加固定字串oldboy大量建立10個html檔案dir=/root/wyb/test10/[  ! -d  $dir  ] && mkdir -p  $dirfor i in `seq 10`do  touch $dir`echo $RANDOM|md5sum|cut -c 1-10`_oldboy.htmldone[[email protected] wyb]# bash test10.sh[[email protected] wyb]# cd test10[[email protected] test10]# ls3fb16229e0_oldboy.html  5bf08cf5ce_oldboy.html  73e073e1e6_oldboy.html  860bafa69b_oldboy.html  c0b0067928_oldboy.html512c517124_oldboy.html  7245bf5bea_oldboy.html  76f98bef45_oldboy.html  94a1245d85_oldboy.html  f37ace5e6a_oldboy.html[[email protected] test10]# 

 

[[email protected] wyb]# cat xiugai.sh #!/bin/bash#將test10目錄下的檔案oldboy全部改成oldgirl(用for迴圈實現),並且html改成大寫。#3fb16229e0_oldboy.html  5bf08cf5ce_oldboy.html  73e073e1e6_oldboy.html  860bafa69b_oldboy.html  c0b0067928_oldboy.html#512c517124_oldboy.html  7245bf5bea_oldboy.html  76f98bef45_oldboy.html  94a1245d85_oldboy.html  f37ace5e6a_oldboy.htmlcd test10for i in `ls` do   a=`echo $i|cut -c 1-10`   mv  ${a}_oldboy.html   ${a}_oldgirl.HTMLdone[[email protected] wyb]# bash xiugai.sh [[email protected] wyb]# cd test10[[email protected] test10]# ls3fb16229e0_oldgirl.HTML  5bf08cf5ce_oldgirl.HTML  73e073e1e6_oldgirl.HTML  860bafa69b_oldgirl.HTML  c0b0067928_oldgirl.HTML512c517124_oldgirl.HTML  7245bf5bea_oldgirl.HTML  76f98bef45_oldgirl.HTML  94a1245d85_oldgirl.HTML  f37ace5e6a_oldgirl.HTML[[email protected] test10]# 

 

shell指令碼,在指定目錄下通過隨機小寫10個字母加固定字串oldboy大量建立10個html檔案。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.