System Administration Practice Homework 2: Shell Programming

Slides:



Advertisements
Similar presentations
Editing Your Faculty Homepage  This tutorial will go through the steps for editing your Faculty homepage.  Thank you to Ryan Vyborny for letting me use.
Advertisements

Java Tutorial – Building GUIs Java with Added Swing Daniel Bryant
1 of 6 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
 What I hate about you things people often do that hurt their Web site’s chances with search engines.
Operating System Program 5 I/O System DMA Device Driver.
Panorama High School E.G.P./ Training to Put Students’ Grades on the Website Wednesday, September 29,
Scoring Program Updates & XML upload to the NSRCA web site July 2013.
Introduction to the WebBoard Terry Dennis. The WebBoard - Our Connection The WebBoard URL is
Shell Scripting Introduction. Agenda What is Shell Scripting? Why use Shell Scripting? Writing and Running a Shell Script Basic Commands -ECHO - REM.
Go to your school’s web locker site school name.schoolweblockers.com) Your user name is the first letter of your first name, the first four.
Go to your school’s web locker site school name.schoolweblockers.com) Your user name is the first letter of your first name, the first 4.
Shell Programming Any command or a sequence of UNIX commands stored in a text file is called a shell program. It is common to call this file a command.
Chapter Five Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command.
System Administration HW3 Shell Script changlp. Computer Center, CS, NCTU 2 Requirements  User socket statistic (20%) Use one-line command to show per-user.
Microsoft Visual Basic 2008 CHAPTER TWELVE Cell Phone Applications and Web Services.
Quiz 15 minutes Open note, open book, open computer Finding the answer – working to get it – is what helps you learn I don’t care how you find the answer,
Chapter Two Creating a First Project in Visual Basic.
Go to your school’s web locker site Your user name is the first letter of your first name, the first four letters of.
11/25/2015Slide 1 Scripts are short programs that repeat sequences of SPSS commands. SPSS includes a computer language called Sax Basic for the creation.
WDO-It! 102 Workshop: Using an abstraction of a process to capture provenance UTEP’s Trust Laboratory NDR HP MP.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
January 2006Colby College ITS Setting Up Course Pages.
All sections to appear here Welcome to my pptPlex Slide Show, this can be executed in either two ways: 1.As a normal PowerPoint slide show: Example hit.
The Basics of Managing Your Department Website March 8, 2012.
System Administration HW3 - Shell Script chenyp. Computer Center, CS, NCTU 2 Requirements  File statistics (20%+10%) use one-line command to show files.
30 Copyright © 2009, Oracle. All rights reserved. Using Oracle Business Intelligence Delivers.
Introduction to Scripting Workshop February 23, 2016.
PowerPoint Adding Hyperlinks and Hiding Slides Learn to Link to websites and other slides in the presentation! Adding Hyperlinks and Hiding Slides Learn.
System Administration HW3 - Shell Script hchung. Computer Center, CS, NCTU 2 Requirements  User connect time statistic script (10%) Use one-line command.
1 After completing this lesson, you will be able to: Create and edit hyperlinks in worksheets. Save worksheets and workbooks as Web pages. Send workbooks.
Cs288 Intensive Programming in Linux
Getting an account with WordPress.com
Subversion Subversion is a brand of version control software that is frequently used to store the code and documentation of a project so as to permit.
Chapter 5 Validating Form Data with JavaScript
CS1010: Intro Workshop.
Bash Introduction (adapted from chapters 1 and 2 of bash Cookbook by Albing, Vossing, & Newham) CPTE 440 John Beckett.
California State University Fresno
2 At the top of the zone in which you want to add the Web Part, click Add a Web Part. In the Add Web Parts to [zone] dialog box, select the check box of.
The Voluntary Pre-K Application in ePlan
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
2 At the top of the zone in which you want to add the Web Part, click Add a Web Part. In the Add Web Parts to [zone] dialog box, select the check box of.
Play Framework: Introduction
PearsonAccess Job Aide Viewing Student Data
Editing Your Faculty Homepage
>> PHP: HTML Integration
The Linux Operating System
Shell Script Assignment 1.
Demo Skype for Business: Meeting Broadcast INSTRUCTIONS:
Global Management System
Sarah Diesburg Operating Systems CS 3430
What is Bash Shell Scripting?
John Carelli, Instructor Kutztown University
Click on the Create Student Account Link
Chapter 6 - Visual Basic Schneider
Guide To UNIX Using Linux Third Edition
Integrating JavaScript and HTML
VBScript Session 6 Dani Vainstein.
About Everything You Always Wanted to Know
Lab 9 & 10: Drill 2 and Homework 4
**Note: slide 10 explains how to access online textbook information
Programming Project #1 Command Shell
More advanced BASH usage
Shell Programming.
Programming Project #1 Fork and Command Shell
Compute System Administration Homework 2: Shell Script
Computer Eng. Software Lab
Web SA: File Upload Function
Linux Shell Script Programming
CST8177 Scripting 2: What?.
Introduction to Bash Programming, part 3
Presentation transcript:

System Administration Practice Homework 2: Shell Programming yench

Requirements 3-1: Filesystem Statistic (20%) 3-2: Dialog Browser (60%) Make a web browser by using dialog 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: 2016/10/14 upload ${student_ID}.tar on E3 Demo at next week. Two day in 2016/10/17~21

3-1: Filesystem Statistic

3-1: Filesystem Statistic - Requirement 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.

3-1: Filesystem Statistic - Requirement Use one-line command Only pipes are allowed. 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. Hint: ls(1) with -A and -R

3-1: Filesystem Statistic - Requirement 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%)

3-2: Dialog browser

Dialog (1) 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).

Terms and Conditions of Use – 3% Use `yesno` dialog: --yesno text height width Example: dialog --title “terms” --yesno “xxx” 200 100 The content of terms don’t matter Place terms in `~/.mybrowser/userterm`

Flowchart NO Terms Exit

Dialog of disagreement Use `msgbox` dialog: --msgbox text height width Example: dialog --title 'Apology' --msgbox "Sorry" 200 100

Flowchart - Homepage (3%) YES Terms Homepage

How to generate a page? Use w3m and `msgbox` dialog What is w3m? a text based web browser and pager dialog --msgbox “$(w3m --dump google.com)” 200 100

Flowchart – URL (12%) Current page Input box If the input is an URL, go to the page. OK You can use RE to determine whether the input is an URL. Using other tricks is OK. Input box Show current url at here Use `inputbox` dialog to get the input.

Flowchart – Built-in command (30%) YES Current page Is the page changed? CANCEL OK NO Input box Do the command If the input starts with ‘/’, it is a built-in command

What commands do we have? /S /source – curl -s -L , w3m --dump_source* Show the source code of the page in the `msgbox` dialog. /L /link – use RE to grep <a href=“link”>…</a> Show all links of this page in the `menu` dialog. Select one of them to go to that link. /D /download – wget, curl -o, fetch -o Show all links of the page in the `menu` dialog. Select one of them to download that link to ~/Downloads/. /B /bookmark – save bookmark in `~/.mybrowser/bookmark` Show `add`, `delete` and all bookmarks. /H /help – place this page in `~/.mybrowser/help` Show the help page.

/S, /source: show the source code

/L, /link: show all links of this page

/D, /download: select a link to download

/B, /bookmark: Show all bookmarks.

/H, /help: the help page

Flowchart – Shell command (6%) Current page Show the result OK Input box Run the shell code If the input starts with ‘!’, it is a shell command

Flowchart – Invalid input (3%) Current page Input box Invalid input Error page

Flowchart – Exit (3%) Current page Input box CANCEL Exit

Bonus 3-1 Top 10 shortest code ( less pipe > less character ) (5%) 3-2 Last page, next page (3%) Use commands to go to last or next page. 3-2 Error log in ~/.mybrowser/error (2%) Without any error output on tty

Help IRC channel #nctuNASA on irc.freenode.net Email ta@nasa.cs.nctu.edu.tw or E3