Shell腳本初學習
阿新 • • 發佈:2017-10-06
mas 一個 暫時 shel cati linux 停止工作 play 第一個
第一個shell程序運行,教程來自:http://jingyan.baidu.com/article/8cdccae947f83e315413cd05.html
代碼如下:
1 #!/bin/sh 2 touch a.txt 3 sleep 10 4 echo "testtesttesttest">>a.txt
不知道為什麽提示:MSYS2 terminal已停止工作。尚未解決。
然後用git pull的代碼
1 #!/bin/bash 2 #mkdir 翟宇豪 3 #cd 翟宇豪 4 #git init 5 #git pull https://git.coding.net/Rio56/wf.git masterView Code6 7 declare -A map=(["冉華"]="https://git.coding.net/Dawnfox/wf.git" 8 ["劉淑霞"]="https://git.coding.net/liusx0303/CountWords.git" 9 ["胡佑蓉"]="https://coding.net/u/huyr000/p/countWord/git" 10 ["王超"]="https://git.coding.net/SuperCodingChao/wfProject.git" 11 ["高遠博"]="https://coding.net/u/Rainbows/p/wc/git" 12 ["陳建宇"]=" https://coding.net/u/MR__Chen/p/Demo/git" 13 ["代秋彤"]="https://git.coding.net/a284617374/soft.git" 14 ["方銘"]="https://coding.net/u/MingZi-/p/cipingtongji/git" 15 ["葛美義"]=" https://git.coding.net/gmyznb/wordcount1.git" 16 ["黃澤宇"]="https://coding.net/u/huangzy_95/p/wf/git" 17["賈男男"]="https://git.coding.net/lynlynyess/Wordcount.git" 18 ["賈雅傑"]="https://git.coding.net/jyj5951/wf.git" 19 ["姜珊"]="https://coding.net/u/js2017102865/p/StreamReader/git" 20 ["闞博文"]="https://git.coding.net/zbwd666/zbwd.git" 21 ["李傳康"]="https://git.coding.net/lick468/wf.git" 22 ["李圓圓"]="https://git.coding.net/lyy181/count.git" 23 ["藺依銘"]="https://git.coding.net/Hitagi123/word-count.git" 24 ["劉成誌"]=" https://git.coding.net/liuchengzhi0944/word_dirt.git" 25 ["劉耀澤"]="https://coding.net/u/liuyz349/p/word_count/git" 26 ["米赫"]="https://git.coding.net/immixiaomi/wf.git" 27 ["苗威"]="https://git.coding.net/Vrocker/wf.git" 28 ["任思佳"]="https://coding.net/u/rensijia/p/count-words/git" 29 ["邵朔"]="https://coding.net/u/ss505072461/p/wf/git" 30 ["宋雨"]="https://coding.net/u/songyuu/p/python_wf/git" 31 ["田繼平"]="https://git.coding.net/tianjiping/11111.git" 32 ["王航"]="https://git.coding.net/wangh013/wordNumber.git" 33 ["王磊"]="https://git.coding.net/137911934/SE20170914.git" 34 ["王偉東"]="https://git.coding.net/wangwd/SecondAssignment.git" 35 ["王玉玲"]="https://coding.net/u/tutu123/p/tutu1234/git" 36 ["吳雨丹"]="https://git.coding.net/clairewyd/wf.git" 37 ["徐劭斌"]="https://git.coding.net/xushaobin/ConsoleApplication3.git" 38 ["楊梓瑞"]="https://git.coding.net/Vector121/homework.git" 39 ["袁玥"]="https://git.coding.net/yuanyue2017102885/wordcount_1and2.git" 40 ["翟宇豪"]="https://git.coding.net/Rio56/wf.git" 41 ["張恩聚"]="https://git.coding.net/ZhangEJ/wf.git" 42 ["鄒雙黛"]="https://git.coding.net/szjzsd/123.git" 43 ) 44 45 for key in ${!map[@]} ; do 46 mkdir $key 47 cd $key 48 git init 49 git pull ${map[$key]} master 50 cd .. 51 done 52 53 54 #echo ${!map[@]} 55 # 56 #echo ${map[@]} 57 # 58 # for key in ${!map[@]} ; do 59 # # echo ${map[$key]} 60 # echo $key; 61 # done
生成的文件夾亂碼:
對shell腳本有了一點點認識,但看它也有變量定義等等,暫時還未學習。
留一個教程之後學習 http://www.runoob.com/linux/linux-shell.html
希望有遇到過此類問題的前輩幫忙解答~
Shell腳本初學習