Assignment 2. Summary. Some Important bash Instructions. CSci132 Practical UNIX and Programming Assignment 2, Fall Prof.
|
|
- Winfred Goodwin
- 6 years ago
- Views:
Transcription
1 Assignment 2 Summary The purpose of this assignment is to give you some practice in bash scripting. When you write a bash script, you are really writing a program in the bash programming language. In class I explained that bash is not just a shell, but a programming language as well, and a bash script can just as well be called a bash program. I mention this now because very soon you will begin writing programs in another programming language, Perl, and this is the rst in a sequence of small steps in mastering Perl. We have been calling your programs shell scripts. A script is a program, make no bones about it. Scripts are programs written in a scripting language, which is a special kind of programming language. All scripting languages are programming languages, but not vice versa. The distinction will be explained in a later lecture. I will call bash both a programming language and a scripting language. This assignment will begin with a review of some of the things that have been covered in class, and then introduce a few things that were not covered in class. Some Important bash Instructions A bash instruction is also called a statement. For example, the if-instruction if test $# -ne 2 then echo usage: $0 arg1 arg2 exit fi is usually referred to as the if-statement. From this point forward, I will call instructions statements. The bash programming language has several statements that are known as looping statements. A looping statement is one that makes it possible to repeat a sequence of statements one or more times. In class we covered the while-statement too: the while-statement is a looping statement whose form (syntax ) is while <expression> <list-of-statements> ne in which <expression> is a statement such as the test command, or any other statement that can be evaluated as being true or false, and <list-of-statements> is any sequence of statements (including looping statements.) The following snippet (little piece) of a script shows one example of a while-statement: This is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit 1
2 echo -n "Try to guess my favorite color:" read guess rest_of_line mycolor=`cat secretfile` # read about backquoted commands like `cat file` while [ $guess!= $mycolor ] echo -n "Sorry, that is not my favorite color. Try again: " read guess rest_of_line ne In the above script, the <expression> part of the while-statement is [ $guess!= $mycolor ] and the <list-of-statements> is the list of two lines echo -n "Sorry, that is not my favorite color. Try again: " read guess rest_of_line The above script will test whether guess is the same string as mycolor, and if it is not, it will execute the echo and read statements and then re-evaluate the test command that compares guess and mycolor. It will keep ing this until the user enters a string that is identical to the string stored in mycolor. When she es, the expression becomes false and the while loop is exited. A while-statement is usually called a while loop because if we visualize the sequence of executed statements as being connected by an imaginary thread, then this thread loops around and around the lines of the script. Bash also has a for-loop. (It has other loops too that I will not discuss here.) The for-loop is very dierent from the while-loop. It has two forms. One form (again the proper term is syntax ) is for <variable> in <argument-list> <list-of-statements> ne and the other is for <variable> <list-of-statements> ne The <variable> can be any valid variable name (words starting with letters and containing letters, digits, and the underscore character.) The <argument-list> can be any sequence of words, including words that look like numbers. Examples of this are for number in for name in John Jacob Judy Jocelyn for word in $* As you can see, this can be very powerful. As with the while-loop, the list of statements is any list of statements, but the intention is that the variable plays a role in this list. For example, the script let sum=0 for number in let square=$number*$number let sum=$sum+$number echo The square of $number is $square ne echo The sum of the numbers is $sum. 2
3 displays ten lines showing the squares of the rst ten positive integers and then displays their sum. Notice how the sum is calculated. The second form of the for-loop es not need an argument list. It automatically assigns to the variable the successive words from the command line arguments of the script when it is run: for word echo $word. ne It is the same as for name in $* echo $word. ne It just prints the words found on the command line one after the other on separate lines. Tasks This assignment consists of two exercises in writing relatively simple shell scripts. writing any script are The objectives when clarity eciency simplicity the script should be easy to understand by someone with a basic knowledge of UNIX; the script should use the least resources possible; and the script should be as simple as possible. An example will demonstrate. Suppose we needed a script that would count the number of lines in a le named molecule containing the word 'ATOM' anywhere on the line. The following script would achieve this: #!/bin/bash grep ' ATOM ' molecule > atomcount wc -l atomcount > answer rm atomcount cat answer rm answer but it is very inecient (because it needlessly creates les and then removes them), it is hard to understand because the reader spends more time reading it and may not be familiar with certain operators such as >, and it is not as simple as it could be. A simple, well-cumented, and ecient solution is #!/bin/bash # Displays how many lines in file molecule contain ATOM as a complete word # Written by Stewart Weiss grep -c ' ATOM ' molecule # The -c option to grep counts matching lines It has comments to explain what it es and it achieves it with a single command that can be looked up easily. Your job is to apply these ideas as you create solutions to the following exercises. 3
4 1. The last command lists information about who has logged into the computer on which it is run. In particular, it has a column with the username, the terminal on which the user was connected, the internet address (the IP address) from which they connected to the computer, and the date and time that they logged in and then logged out if they did. If they logged out it also displays the total time they were logged in. For example, this is an entry for me on cslab12: sweiss pts/ Thu Sep 14 13:05-14:27 (01:22) If the username is too long it is truncated, but there are options to display the full username. For this exercise you are to write a bash script named logincount that takes a list of usernames as its command line arguments and displays on the screen, for each user name, a message of the form Number of times that <username> logged into this machine is <N > where <N> is to be replaced by the number of records that the last command output that match <username> exactly. For example, if I enter the command logincount sweiss it should output something like Number of times that sweiss logged into this machine is 7 If a name given as an argument is not a username, nothing is printed for that name. On the other hand, if no names are given, it is an error and the command should display the error message, Usage: logincount <list of usernames>. 2. A DNA string is a sequence of the letters a, c, g, and t in any order. For example, aacgtttgtaaccag is a DNA string of length 15. Each sequence of three consecutive letters is called a con. For example, in the preceding string, the cons are aac, gtt, tgt, aac, and cag. If we ignored the rst letter and started listing the cons starting at the second a, the cons would be acg, ttt, gta, and acc, and we would ignore the last ag. The letters are called bases. A DNA string can be hundreds of thousands of cons long, even millions of cons long, which means that it is infeasible to count them by hand. It would be useful to have a simple script that could count the number of occurrences of a specic con in such a string. For instance, for the example string above such a script would tell us that aac occurs three times and tgt occurs once. More generally, we want to be able to nd occurrences of arbitrary sequences of bases in a given DNA string, such as how many times ttatg occurs, or how many times cgacgattag occurs. Your job is to write a script named countmatches that expects at least two arguments on the command line. The rst argument is the pathname of a le containing a valid DNA string with no newline characters or white space characters of any kind within it. (It will be terminated with a newline character.) This le contains nothing but a sequence of the letters a, c, g, and t. The remaining arguments are strings containing only the bases a, c, g, and t in any order. For each valid argument string, it will search the DNA string in the le and count how many non-overlapping occurrences of that argument string are in the DNA string. To make sure you understand what non-overlapping means, the string ata occurs just once in the string atata, not twice, because the two occurrences overlap. If your script is called correctly, it will output for each argument a line containing the argument string followed by how many times it occurs in the string. If it nds no occurrences, it should output 0 as a count. For example, if the string aaccgtttgtaaccggaac is in a le named dnafile, then your script should work like this: $ countmatches dnafile ttt ttt 1 $ countmatches dnafile aac ggg aaccg 4
5 aac 3 ggg 0 aaccg 2 Warning: if it is given valid arguments, the script is not to output anything except the strings and their associated counts. No fancy messages, no words! The script should check that the rst argument is a le name and that there is at least one other argument after it. If the rst is not a le name or if it is missing anything after the lename, the script should print a how-to-use-me message and then exit. It is not required to check that the le is in the proper form, or that the string contains nothing but the letters a, c, g, and t. Hint: You can solve this problem using grep and one other command that appears in this cument. Although there are other lters, you not need them to solve this problem. You have to read more about grep to know how to use it. The other command has appeared in the slides already. Grading Rubric This homework is graded on a 100 point scale. Each script is worth 50 points. Each script will be graded on its correctness foremost. This means that it es exactly what the assignment states it must, in detail. Correctness is worth 70% of the grade. Then it is graded on its clarity, simplicity, and eciency, as described above. These qualitative measures are worth 30% of the grade. Submitting the Homework This assignment is due by the end of the day (i.e. 11:59PM, EST) on Thursday, September 28, You will submit it by putting it into a particular directory in our le system. In particular, there is a directory in the CSci Department network whose full path name is /data/biocs/b/student.accounts/cs132/projects/project2. To submit your project, you must follow the instructions below exactly! Do not deviate from these instructions. To be precise: 1. Login using ssh to eniac.cs.hunter.cuny.edu with your valid username and password, and then ssh into any cslab host. 2. In your own home directory, create a directory named project2_username, where username is your username on our system. 3. Put copies of the two scripts that you have written into this directory. Make sure they are named logincount and countmatches. 4. Run the command zip -r project2_username.zip project2_username where username is replaced by your username. This will create the le project2_username.zip. 5. Run the command /data/biocs/b/student.accounts/cs132/bin/submitproject 2 project2_username.zip 5
6 Do exactly this, of course with your real username in place of the placeholder username. Do not mistype it. The command will create a copy of the le project2_username.zip in the directory /data/biocs/b/student.accounts/cs132/projects/project2 It will be named project2_username, where username is your username on the network. You will not be able to read this le, nor will anyone else except for me. If you decide to make any changes and resubmit, just run the command again and it will replace the old le with the new one. I will be able to unzip the le, extracting whatever les you created. Do not try to put your le into this directory in any other way - you will be unable to this. Although these instructions may seem complicated, they simplify the way you submit your work and the way I can retrieve it. If you make mistakes, just start over. If things n't seem to work out, post a question on Piazza with the details included. 6
Assignment 3, Due October 4
Assignment 3, Due October 4 1 Summary This assignment gives you practice with writing shell scripts. Shell scripting is also known as bash programming. Your shell is bash, and when you write a shell script
More informationAssignment 4. the three-dimensional positions of every single atom in the le,
Assignment 4 1 Overview and Background Many of the assignments in this course will introduce you to topics in computational biology. You do not need to know anything about biology to do these assignments
More informationAssignment 2, due September 17
Assignment 2, due September 17 The objectives of this assignment are to introduce you to some simple UNIX commands, to give you practice working with directories and the le hierarchy, and to give you practice
More informationProject 6: Extracting Data from PDB Files
: Extracting Data from PDB Files Overview In this assignment, your Perl program will let a user get information about a macromolecule represented by a PDB le whose pathname is specied on the command line.
More informationAssignment 4. Overview. Prof. Stewart Weiss. CSci 335 Software Design and Analysis III Assignment 4
Overview This assignment combines several dierent data abstractions and algorithms that we have covered in class, including priority queues, on-line disjoint set operations, hashing, and sorting. The project
More information28-Nov CSCI 2132 Software Development Lecture 33: Shell Scripting. 26 Shell Scripting. Faculty of Computer Science, Dalhousie University
Lecture 33 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lecture 33: Shell Scripting 28-Nov-2018 Location: Chemistry 125 Time: 12:35 13:25 Instructor: Vla Keselj
More informationA Big Step. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers
A Big Step Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers Copyright 2006 2009 Stewart Weiss What a shell really does Here is the scoop on shells. A shell is a program
More informationScripting. More Shell Scripts. Adapted from Practical Unix and Programming Hunter College
Scripting More Shell Scripts Adapted from Practical Unix and Programming Hunter College Copyright 2006 2009 Stewart Weiss Back to shell scripts Now that you've learned a few commands and can edit files,
More informationScripting. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers
Scripting Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers Adapted from Practical Unix and Programming Hunter College Copyright 2006 2009 Stewart Weiss What a shell
More informationGetting Started. Logging In and Out. Adapted from Practical Unix and Programming Hunter College
Getting Started Logging In and Out Adapted from Practical Unix and Programming Hunter College Copyright 2006 Stewart Weiss Getting started: logging in and out Every user in UNIX has a username (also called
More informationCS214 Advanced UNIX Lecture 4
CS214 Advanced UNIX Lecture 4 March 2, 2005 Passing arguments to scripts When you invoke a command like > cat f1 f2 f3 f1, f2, f3 are all arguments you pass to the cat command. Many times in your script
More informationPerl Basics. Structure, Style, and Documentation
Perl Basics Structure, Style, and Documentation Copyright 2006 2009 Stewart Weiss Easy to read programs Your job as a programmer is to create programs that are: easy to read easy to understand, easy to
More informationCOMP2100/2500 Lecture 17: Shell Programming II
[ANU] [DCS] [COMP2100/2500] [Description] [Schedule] [Lectures] [Labs] [Homework] [Assignments] [COMP2500] [Assessment] [PSP] [Java] [Reading] [Help] COMP2100/2500 Lecture 17: Shell Programming II Summary
More informationCsci 132 Spring 13. Assignment 2 Due: Tuesday, March 5 (by 11:59PM)
Csci 132 Spring 13 Assignment 2 Due: Tuesday, March 5 (by 11:59PM) A. Readings Read and understand this part before starting working on the exercises of part B. Variables In a Bash script a variable can
More informationexample: name1=jan name2=mike export name1 In this example, name1 is an environmental variable while name2 is a local variable.
Bourne Shell Programming Variables - creating and assigning variables Bourne shell use the set and unset to create and assign values to variables or typing the variable name, an equal sign and the value
More informationCS Unix Tools & Scripting
Cornell University, Spring 2014 1 February 24, 2014 1 Slides evolved from previous versions by Hussam Abu-Libdeh and David Slater A note on awk for (item in array) The order in which items are returned
More informationUNIX shell scripting
UNIX shell scripting EECS 2031 Summer 2014 Przemyslaw Pawluk June 17, 2014 What we will discuss today Introduction Control Structures User Input Homework Table of Contents Introduction Control Structures
More information22-Sep CSCI 2132 Software Development Lecture 8: Shells, Processes, and Job Control. Faculty of Computer Science, Dalhousie University
Lecture 8 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lecture 8: Shells, Processes, and Job Control 22-Sep-2017 Location: Goldberg CS 127 Time: 14:35 15:25 Instructor:
More informationShell Control Structures
Shell Control Structures CSE 2031 Fall 2010 27 November 2010 1 Control Structures if else for while case (which) until 2 1 if Statement and test Command Syntax: if condition command(s) elif condition_2
More informationShell Control Structures
Shell Control Structures EECS 2031 20 November 2017 1 Control Structures l if else l for l while l case (which) l until 2 1 if Statement and test Command l Syntax: if condition command(s) elif condition_2
More informationPattern Matching. An Introduction to File Globs and Regular Expressions
Pattern Matching An Introduction to File Globs and Regular Expressions Copyright 2006 2009 Stewart Weiss The danger that lies ahead Much to your disadvantage, there are two different forms of patterns
More informationCENG 334 Computer Networks. Laboratory I Linux Tutorial
CENG 334 Computer Networks Laboratory I Linux Tutorial Contents 1. Logging In and Starting Session 2. Using Commands 1. Basic Commands 2. Working With Files and Directories 3. Permission Bits 3. Introduction
More information9.2 Linux Essentials Exam Objectives
9.2 Linux Essentials Exam Objectives This chapter will cover the topics for the following Linux Essentials exam objectives: Topic 3: The Power of the Command Line (weight: 10) 3.3: Turning Commands into
More informationOverview of the UNIX File System. Navigating and Viewing Directories
Overview of the UNIX File System Navigating and Viewing Directories Copyright 2006 Stewart Weiss The UNIX file system The most distinguishing characteristic of the UNIX file system is the nature of its
More informationLab #12: Shell Scripting
Lab #12 Page 1 of 11 Lab #12: Shell Scripting Students will familiarize themselves with UNIX shell scripting using basic commands to manipulate the le system. Part A Instructions: This part will be demonstrated
More informationCOMP 4/6262: Programming UNIX
COMP 4/6262: Programming UNIX Lecture 12 shells, shell programming: passing arguments, if, debug March 13, 2006 Outline shells shell programming passing arguments (KW Ch.7) exit status if (KW Ch.8) test
More informationINd_rasN SOME SHELL SCRIPTING PROGRAMS. 1. Write a shell script to check whether the name passed as first argument is the name of a file or directory.
1. Write a shell script to check whether the name passed as rst argument is the name of a le or directory. Ans: #!/bin/bash if [ -f $1 ] echo "$1 is a le" echo "$1 is not a le" 2. Write a shell script
More informationCSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209
CSC209 Software Tools and Systems Programming https://mcs.utm.utoronto.ca/~209 What is this Course About? Software Tools Using them Building them Systems Programming Quirks of C The file system System
More informationEECS2031 Winter Software Tools. Assignment 1 (15%): Shell Programming
EECS2031 Winter 2018 Software Tools Assignment 1 (15%): Shell Programming Due Date: 11:59 pm on Friday, Feb 9, 2018 Objective In this assignment, you will be writing four shell programs. The first program
More informationShell programming. Introduction to Operating Systems
Shell programming Introduction to Operating Systems Environment variables Predened variables $* all parameters $# number of parameters $? result of last command $$ process identier $i parameter number
More informationPattern Matching. An Introduction to File Globs and Regular Expressions. Adapted from Practical Unix and Programming Hunter College
Pattern Matching An Introduction to File Globs and Regular Expressions Adapted from Practical Unix and Programming Hunter College Copyright 2006 2009 Stewart Weiss The danger that lies ahead Much to your
More informationUsing bash. Administrative Shell Scripting COMP2101 Fall 2017
Using bash Administrative Shell Scripting COMP2101 Fall 2017 Bash Background Bash was written to replace the Bourne shell The Bourne shell (sh) was not a good candidate for rewrite, so bash was a completely
More informationBourne Shell Reference
> Linux Reviews > Beginners: Learn Linux > Bourne Shell Reference Bourne Shell Reference found at Br. David Carlson, O.S.B. pages, cis.stvincent.edu/carlsond/cs330/unix/bshellref - Converted to txt2tags
More informationThe Unix Shell & Shell Scripts
The Unix Shell & Shell Scripts You should do steps 1 to 7 before going to the lab. Use the Linux system you installed in the previous lab. In the lab do step 8, the TA may give you additional exercises
More informationAdvanced Bash Scripting
for HPC SysAdmins Piero Calucci 1 2 1 Scuola Internazionale Superiore di Studi Avanzati Trieste 2 Democritos Modeling Center for Research in Atomistic Simulation INFM November 2008 Advanced School in High
More informationExploring UNIX: Session 3
Exploring UNIX: Session 3 UNIX file system permissions UNIX is a multi user operating system. This means several users can be logged in simultaneously. For obvious reasons UNIX makes sure users cannot
More informationToday. Review. Unix as an OS case study Intro to Shell Scripting. What is an Operating System? What are its goals? How do we evaluate it?
Today Unix as an OS case study Intro to Shell Scripting Make sure the computer is in Linux If not, restart, holding down ALT key Login! Posted slides contain material not explicitly covered in class 1
More informationModularity and Reusability I. Functions and code reuse
Modularity and Reusability I Functions and code reuse Copyright 2006 2009 Stewart Weiss On being efficient When you realize that a piece of Perl code that you wrote may be useful in future programs, you
More informationCSC209. Software Tools and Systems Programming. https://mcs.utm.utoronto.ca/~209
CSC209 Software Tools and Systems Programming https://mcs.utm.utoronto.ca/~209 What is this Course About? Software Tools Using them Building them Systems Programming Quirks of C The file system System
More informationWhile Statement Examples. While Statement (35.15) Until Statement (35.15) Until Statement Example
While Statement (35.15) General form. The commands in the loop are performed while the condition is true. while condition one-or-more-commands While Statement Examples # process commands until a stop is
More information27-Sep CSCI 2132 Software Development Lab 4: Exploring bash and C Compilation. Faculty of Computer Science, Dalhousie University
Lecture 4 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lab 4: Exploring bash and C Compilation 27-Sep-2017 Location: Goldberg CS Building Time: Wednesday, 16:05
More informationI/O and Shell Scripting
I/O and Shell Scripting File Descriptors Redirecting Standard Error Shell Scripts Making a Shell Script Executable Specifying Which Shell Will Run a Script Comments in Shell Scripts File Descriptors Resources
More informationVi & Shell Scripting
Vi & Shell Scripting Comp-206 : Introduction to Week 3 Joseph Vybihal Computer Science McGill University Announcements Sina Meraji's office hours Trottier 3rd floor open area Tuesday 1:30 2:30 PM Thursday
More informationbash Tests and Looping Administrative Shell Scripting COMP2101 Fall 2017
bash Tests and Looping Administrative Shell Scripting COMP2101 Fall 2017 Command Lists A command is a sequence of commands separated by the operators ; & && and ; is used to simply execute commands in
More informationbash Tests and Looping Administrative Shell Scripting COMP2101 Fall 2017
bash Tests and Looping Administrative Shell Scripting COMP2101 Fall 2017 Command Lists A command is a sequence of commands separated by the operators ; & && and ; is used to simply execute commands in
More informationAssignment 3: Processing New York City Open Data Using Linked Lists
Assignment 3: Processing New York City Open Data Using Linked Lists 1 Summary Due date: October 26, 11:59PM EST. In this assignment, you will use linked lists to manage objects that represent New York
More informationEssential Skills for Bioinformatics: Unix/Linux
Essential Skills for Bioinformatics: Unix/Linux SHELL SCRIPTING Overview Bash, the shell we have used interactively in this course, is a full-fledged scripting language. Unlike Python, Bash is not a general-purpose
More informationA shell can be used in one of two ways:
Shell Scripting 1 A shell can be used in one of two ways: A command interpreter, used interactively A programming language, to write shell scripts (your own custom commands) 2 If we have a set of commands
More informationDo not start the test until instructed to do so!
Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted one-page formula sheet. No calculators or other electronic devices
More informationEssentials for Scientific Computing: Bash Shell Scripting Day 3
Essentials for Scientific Computing: Bash Shell Scripting Day 3 Ershaad Ahamed TUE-CMS, JNCASR May 2012 1 Introduction In the previous sessions, you have been using basic commands in the shell. The bash
More informationSubcontractors. bc math help for the shell. interactive or programatic can accept its commands from stdin can accept an entire bc program s worth
Subcontractors bc, xargs,, find David 2011-14 bc math help for the shell interactive or programatic can accept its commands from stdin can accept an entire bc program s worth 1 bc math help for shell bc,
More informationDAVE LIDDAMENT INTRODUCTION TO BASH
DAVE LIDDAMENT INTRODUCTION TO BASH @daveliddament FORMAT Short lectures Practical exercises (help each other) Write scripts LEARNING OBJECTIVES What is Bash When should you use Bash Basic concepts of
More informationLecture 02 The Shell and Shell Scripting
Lecture 02 The Shell and Shell Scripting In this course, we need to be familiar with the "UNIX shell". We use it, whether bash, csh, tcsh, zsh, or other variants, to start and stop processes, control the
More informationAssignment 2: Processing New York City Open Data
Assignment 2: Processing New York City Open Data Due date: Sept. 28, 11:59PM EST. 1 Summary This assignment is designed to expose you to the use of open data. Wikipedia has a good description of open data:
More informationData Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi.
Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 18 Tries Today we are going to be talking about another data
More informationWhat is Bash Shell Scripting?
What is Bash Shell Scripting? A shell script is a script written for the shell, or command line interpreter, of an operating system. The shell is often considered a simple domain-specic programming language.
More informationMore Scripting Techniques Scripting Process Example Script
More Scripting Techniques Scripting Process Example Script 1 arguments to scripts positional parameters input using read exit status test program, also known as [ if statements error messages 2 case statement
More informationAnswers to Even-numbered Exercises
11 Answers to Even-numbered Exercises 1. ewrite t propriate actions xists and the user does not have write permission to the le. Verify that the modied script works. 2. The special parameter "$@" is referenced
More informationAssignment 3: Playlist Creator
: Playlist Creator Summary Many software audio players let the user organize his or her music in various playlists that are saved as separate files without duplicating the music files themselves. In this
More informationLecture 4. Log into Linux Reminder: Homework 1 due today, 4:30pm Homework 2 out, due next Tuesday Project 1 out, due next Thursday Questions?
Lecture 4 Log into Linux Reminder: Homework 1 due today, 4:30pm Homework 2 out, due next Tuesday Project 1 out, due next Thursday Questions? Tuesday, September 7 CS 375 UNIX System Programming - Lecture
More informationGit. Charles J. Geyer School of Statistics University of Minnesota. Stat 8054 Lecture Notes
Git Charles J. Geyer School of Statistics University of Minnesota Stat 8054 Lecture Notes 1 Before Anything Else Tell git who you are. git config --global user.name "Charles J. Geyer" git config --global
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday
More informationCSE 374: Programming Concepts and Tools. Eric Mullen Spring 2017 Lecture 4: More Shell Scripts
CSE 374: Programming Concepts and Tools Eric Mullen Spring 2017 Lecture 4: More Shell Scripts Homework 1 Already out, due Thursday night at midnight Asks you to run some shell commands Remember to use
More informationCOMS 6100 Class Notes 3
COMS 6100 Class Notes 3 Daniel Solus September 1, 2016 1 General Remarks The class was split into two main sections. We finished our introduction to Linux commands by reviewing Linux commands I and II
More informationOverview of the UNIX File System
Overview of the UNIX File System Navigating and Viewing Directories Adapted from Practical Unix and Programming Hunter College Copyright 2006 Stewart Weiss The UNIX file system The most distinguishing
More informationCSE 390a Lecture 6. bash scripting continued; remote X windows; unix tidbits
CSE 390a Lecture 6 bash scripting continued; remote X windows; unix tidbits slides created by Marty Stepp, modified by Jessica Miller and Ruth Anderson http://www.cs.washington.edu/390a/ 1 Lecture summary
More informationLecture 5. Essential skills for bioinformatics: Unix/Linux
Lecture 5 Essential skills for bioinformatics: Unix/Linux UNIX DATA TOOLS Text processing with awk We have illustrated two ways awk can come in handy: Filtering data using rules that can combine regular
More informationWhen talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used:
Linux Tutorial How to read the examples When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used: $ application file.txt
More informationA Guide to Condor. Joe Antognini. October 25, Condor is on Our Network What is an Our Network?
A Guide to Condor Joe Antognini October 25, 2013 1 Condor is on Our Network What is an Our Network? The computers in the OSU astronomy department are all networked together. In fact, they re networked
More informationShell Script Example. Here is a hello world shell script: $ ls -l -rwxr-xr-x 1 horner 48 Feb 19 11:50 hello* $ cat hello #!/bin/sh
Shell Programming Shells A shell can be used in one of two ways: A command interpreter, used interactively A programming language, to write shell scripts (your own custom commands) Shell Scripts A shell
More informationScripting Languages Course 1. Diana Trandabăț
Scripting Languages Course 1 Diana Trandabăț Master in Computational Linguistics - 1 st year 2017-2018 Today s lecture Introduction to scripting languages What is a script? What is a scripting language
More informationChapter-3. Introduction to Unix: Fundamental Commands
Chapter-3 Introduction to Unix: Fundamental Commands What You Will Learn The fundamental commands of the Unix operating system. Everything told for Unix here is applicable to the Linux operating system
More informationCSE 390a Lecture 6. bash scrip'ng con'nued; remote X windows; unix 'dbits
CSE 390a Lecture 6 bash scrip'ng con'nued; remote X windows; unix 'dbits slides created by Marty Stepp, modified by Jessica Miller h>p://www.cs.washington.edu/390a/ 1 Lecture summary more shell scrip'ng
More informationCMPS 12A Introduction to Programming Lab Assignment 7
CMPS 12A Introduction to Programming Lab Assignment 7 In this assignment you will write a bash script that interacts with the user and does some simple calculations, emulating the functionality of programming
More informationBash scripting basics
Bash scripting basics prepared by Anatoliy Antonov for ESSReS community September 2012 1 Outline Definitions Foundations Flow control References and exercises 2 Definitions 3 Definitions Script - [small]
More informationBasic Linux (Bash) Commands
Basic Linux (Bash) Commands Hint: Run commands in the emacs shell (emacs -nw, then M-x shell) instead of the terminal. It eases searching for and revising commands and navigating and copying-and-pasting
More informationAssignment 2: New York City Street Trees
1 Overview In 2016, New York City made public the results of TreesCount!, the 2015 Street Tree Census, conducted by volunteers and sta organized by the NYC Department of Parks & Recreation as well as partner
More informationCS 25200: Systems Programming. Lecture 10: Shell Scripting in Bash
CS 25200: Systems Programming Lecture 10: Shell Scripting in Bash Dr. Jef Turkstra 2018 Dr. Jeffrey A. Turkstra 1 Lecture 10 Getting started with Bash Data types Reading and writing Control loops Decision
More informationCSCI 211 UNIX Lab. Shell Programming. Dr. Jiang Li. Jiang Li, Ph.D. Department of Computer Science
CSCI 211 UNIX Lab Shell Programming Dr. Jiang Li Why Shell Scripting Saves a lot of typing A shell script can run many commands at once A shell script can repeatedly run commands Help avoid mistakes Once
More informationCSE 374 Midterm Exam Sample Solution 2/11/13. Question 1. (8 points) What does each of the following bash commands do?
Question 1. (8 points) What does each of the following bash commands do? (a) rm x Remove the file named x in the current directory. (b) rm *x Remove all files in the current directory whose names end with
More informationProfessor Hugh C. Lauer CS-1004 Introduction to Programming for Non-Majors
First Python Program Professor Hugh C. Lauer CS-1004 Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction to Computer Science, 2 nd edition, by
More informationShell Programming (bash)
Shell Programming Shell Programming (bash) Commands run from a file in a subshell A great way to automate a repeated sequence of commands. File starts with #!/bin/bash absolute path to the shell program
More informationProgramming. We will be introducing various new elements of Python and using them to solve increasingly interesting and complex problems.
Plan for the rest of the semester: Programming We will be introducing various new elements of Python and using them to solve increasingly interesting and complex problems. We saw earlier that computers
More informationShell Programming. Introduction to Linux. Peter Ruprecht Research CU Boulder
Introduction to Linux Shell Programming Peter Ruprecht peter.ruprecht@colorado.edu www.rc.colorado.edu Downloadable Materials Slides and examples available at https://github.com/researchcomputing/ Final_Tutorials/
More informationCSE 374 Midterm Exam Sample Solution 2/6/12
Question 1. (12 points) Suppose we have the following subdirectory structure inside the current directory: docs docs/friends docs/friends/birthdays.txt docs/friends/messages.txt docs/cse374 docs/cse374/notes.txt
More informationContents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...
Contents Note: pay attention to where you are........................................... 1 Note: Plaintext version................................................... 1 Hello World of the Bash shell 2 Accessing
More informationCSE II-Sem)
a) Write a shell script that displays a list of all the files in the current directory to which the user has read, write and execute permissions. b) Develop an interactive script that asks for a word and
More informationOriginal Script. Display commands to manually creating an account. #!/bin/bash
To show some of the basic components of shell scripting, we are going to take a common task, creating a new user, and design a script to help automate this process. Original Script Display commands to
More informationHomework 6: Higher-Order Procedures Due: 10:00 PM, Oct 17, 2017
Integrated Introduction to Computer Science Hughes Homework 6: Higher-Order Procedures Due: 10:00 PM, Oct 17, 2017 Contents 1 Fun with map (Practice) 2 2 Unfold (Practice) 3 3 Map2 3 4 Fold 4 5 All You
More informationfind starting-directory -name filename -user username
Lab 7: Input and Output The goal of this lab is to gain proficiency in using I/O redirection to perform tasks on the system. You will combine commands you have learned in this course using shell redirection,
More informationThis homework is due by 11:59:59 PM on Thursday, October 12, 2017.
CSCI 4210 Operating Systems CSCI 6140 Computer Operating Systems Homework 2 (document version 1.3) Process Creation and Inter-Process Communication (IPC) in C Overview This homework is due by 11:59:59
More informationA Brief Introduction to the Linux Shell for Data Science
A Brief Introduction to the Linux Shell for Data Science Aris Anagnostopoulos 1 Introduction Here we will see a brief introduction of the Linux command line or shell as it is called. Linux is a Unix-like
More informationCS1101: Lecture 9 The Shell as a Programming Language
CS1101: Lecture 9 The Shell as a Programming Language Dr. Barry O Sullivan b.osullivan@cs.ucc.ie Counting Arguments Using read Lecture Outline Arithmetic using expr Course Homepage http://www.cs.ucc.ie/
More informationRegular Expressions. Regular Expression Syntax in Python. Achtung!
1 Regular Expressions Lab Objective: Cleaning and formatting data are fundamental problems in data science. Regular expressions are an important tool for working with text carefully and eciently, and are
More informationSharpen Exercise: Using HPC resources and running parallel applications
Sharpen Exercise: Using HPC resources and running parallel applications Andrew Turner, Dominic Sloan-Murphy, David Henty, Adrian Jackson Contents 1 Aims 2 2 Introduction 2 3 Instructions 3 3.1 Log into
More information(Refer Slide Time: 01:12)
Internet Technology Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture No #22 PERL Part II We continue with our discussion on the Perl
More informationThe Shell. EOAS Software Carpentry Workshop. September 20th, 2016
The Shell EOAS Software Carpentry Workshop September 20th, 2016 Getting Started You need to download some files to follow this lesson. These files are found on the shell lesson website (see etherpad) 1.
More informationProgramming Standards: You must conform to good programming/documentation standards. Some specifics:
CS3114 (Spring 2011) PROGRAMMING ASSIGNMENT #3 Due Thursday, April 7 @ 11:00 PM for 100 points Early bonus date: Wednesday, April 6 @ 11:00 PM for a 10 point bonus Initial Schedule due Thursday, March
More informationShell Programming Overview
Overview Shell programming is a way of taking several command line instructions that you would use in a Unix command prompt and incorporating them into one program. There are many versions of Unix. Some
More informationLinux Shell Scripting. Linux System Administration COMP2018 Summer 2017
Linux Shell Scripting Linux System Administration COMP2018 Summer 2017 What is Scripting? Commands can be given to a computer by entering them into a command interpreter program, commonly called a shell
More information