Download presentation
Presentation is loading. Please wait.
1
Compute System Administration Homework 2: Shell Script
zswu
2
Requirements 2-1: Filesystem Statistics (20%)
2-2: Course Registration System (60%+20%) 簡易的模擬排課系統 ❤ Bonus Modify code by yourself at demo (20%) Please write the scripts in Bourne Shell (sh) No score if you use csh, bash or other languages. Due date: 2018/10/17 12:00 Upload ${student_ID}.tar on New E3 (
3
2-1: Filesystem Statistics
4
2-1: Filesystem Statistics – Requirement (1/3)
Inspect the current directory(“.”) and all sub-directory. Calculate the number of directories. Do not include ‘.’ and ‘..’ Calculate the number of files. Calculate the sum of all file size. List the top 5 biggest files. Only consider the regular file. Do not count in the link, FIFO, block device... etc.
5
2-1: Filesystem Statistics – Requirement (2/3)
Use one-line command No temporary file or shell variables. No “&&” “||” “>” “>>” “<” “;” “&”, but you can use them in the awk command. Actually, you don’t need them to finish this homework. Only pipes are allowed. Hint: ls(1) with -A and -R
6
2-1: Filesystem Statistics – Requirement (3/3)
Grade File is executable. (4%) List top 5 file size and name. (4%) Dir num is correct. (4%) File num is correct. (4%) Total size is correct. (4%)
7
2-2: Course Registration System (CRS)
8
2-2: CRS – Requirements 使用 curl 到 timetable.nctu.edu.tw 下載課程表,只有在資料不存在時才要執行此步驟。(15%) 選課程式可以在選單列出課程,必須記住上次選取的課程和所有的選項(包含程式重開後),若使用者選擇取消則不修改。(15%) 判斷衝堂並讓使用者回到選單修改衝堂的課程。(15%) 輸出課表時可以選擇顯示課程名稱或教室、是否顯示星期六日和 NMXY 等較不重要的時間。(3%+3%) 輸出整齊的表格(3%) ,表格中可以在同一格內換行顯示。(6%) 禁止使用 Python、Ruby等其他程式語言和sh以外的Shell。可使用的套件以工作站(bsd1~4)為準。
9
2-2: CRS 選擇Option 應至少出現這兩個功能的選項。
10
2-2: CRS – Dialog Dialog is a program that will let you to present a variety of questions or display messages using dialog boxes from a shell script. These types of dialog boxes are implemented (though not all are necessarily compiled into dialog): buildlist, calendar, checklist, dselect, editbox, form, fselect, gauge, infobox, inputbox, inputmenu, menu, mixedform, mixedgauge, msgbox (message), passwordbox, pause, prgbox, programbox, progressbox, radiolist, rangebox, passwordform, tailbox, tailboxbg, textbox, timebox, treeview, and yesno (yes/no).
11
2-2: CRS – Hint (1/2) 下載課表的 JSON 檔可以使用以下指令:
curl ' --data 'm_acy=107&m_sem=1&m_degree=3&m_dep_id=17&m_group=**&m_grade=**&m_class=**&m_option=**&m_crsname=**&m_teaname=**&m_cos_id=**&m_cos_code=**&m_crstime=**&m_crsoutline=**&m_costype=**' 以上指令會下載資工系的課表,作業請用上面的課表為主,JSON的處理請使用內建的工具想辦法完成。 若無法完成可以自行手動輸出課表資料完成後面的部份,並扣除此部分的分數。
12
2-2: CRS – Hint (2/2) 課程名稱請使用英文課程名稱。 若課程使用多間教室,則在所有的課程時間中顯示所有的課程教室。
顯示表格只要能對齊對應的欄位即可。
13
2-2: CRS – Recommend Workflow
14
2-2: CRS – Bonus 空堂選課(顯示所有目前可選且不會衝堂的課程)。(10%) 課程搜尋
輸入課程部分名稱,顯示包含該關鍵字的所有課程。(5%) 輸入課程時間,顯示包含該時間的所有課程。(5%) ex. 輸入: 4GH ;顯示: 4GH或是1B4GH等的課程,但不包含只有 4G 或是 4H 的課程
15
Help! Email to ta@nasa.cs.nctu.edu.tw New E3 https://e3new.nctu.edu.tw
Office hour: 3GH at EC318 Q:為何出這個作業? A :覺得好玩😜
Similar presentations