Scripting Tools, languages and the Shell intERLab at AIT

Slides:



Advertisements
Similar presentations
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Advertisements

CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Linux+ Guide to Linux Certification, Second Edition
The Unix Shell. Operating System shell The shell is a command interpreter It forms the interface between a user and the operating system When you log.
Scripting Languages CS351 – Programming Paradigms.
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Guide to Linux Installation and Administration, 2e1 Chapter 6 Using the Shell and Text Files.
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
Using Unix Shell Scripts to Manage Large Data
Shell Programming, or Scripting Shirley Moore CPS 5401 Fall August 29,
Advanced File Processing
Welcome to CSE  Name: Di Cao   Classroom: DL357  Class Time: T 8:30am - 9:18am  Office.
Introduction to Shell Script Programming
2008 Bangkok, Thailand Scripting Tools, languages and the Shell intERLab at AIT Network Management Workshop March – Bangkok, Thailand.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
LIN 6932 Unix Lecture 6 Hana Filip. LIN 6932 HW6 - Part II solutions posted on my website see syllabus.
Chapter 6: Shell Programming
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
GNU Compiler Collection (GCC) and GNU C compiler (gcc) tools used to compile programs in Linux.
CS 6560 Operating System Design Lecture 3:Tour of GNU/Linux.
Shell Script Programming. 2 Using UNIX Shell Scripts Unlike high-level language programs, shell scripts do not have to be converted into machine language.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command to search for.
Linux+ Guide to Linux Certification, Third Edition
Chapter Five Advanced File Processing Guide To UNIX Using Linux Fourth Edition Chapter 5 Unix (34 slides)1 CTEC 110.
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.
Shell Programming. Introducing UNIX Shells  Shell is also a programming language and provides various features like variables, branching, looping and.
Module 6 – Redirections, Pipes and Power Tools.. STDin 0 STDout 1 STDerr 2 Redirections.
Agenda Regular Expressions (Appendix A in Text) –Definition / Purpose –Commands that Use Regular Expressions –Using Regular Expressions –Using the Replacement.
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
UNIX/LINUX SHELLS.  “A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and.
Introduction to Unix – CS 21 Lecture 12. Lecture Overview A few more bash programming tricks The here document Trapping signals in bash cut and tr sed.
Chapter Five Advanced File Processing. 2 Lesson A Selecting, Manipulating, and Formatting Information.
40 Years and Still Rocking the Terminal!
CSC414 “Introduction to UNIX/ Linux” Lecture 5. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Chapter Six Introduction to Shell Script Programming.
1 Unix/Linux commands and shell programming-Part 2 (Dr. Mohamed El Bachir Menai)
Linux+ Guide to Linux Certification, Second Edition
CS 403: Programming Languages Lecture 20 Fall 2003 Department of Computer Science University of Alabama Joel Jones.
1 Lecture 7 Introduction to Shell Scripts COP 3353 Introduction to UNIX.
Linux Administration Working with the BASH Shell.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
2008 Bangkok, Thailand Scripting Tools, languages and the Shell intERLab at AIT Network Management Workshop March – Bangkok, Thailand.
CSE 303 Concepts and Tools for Software Development Richard C. Davis UW CSE – 10/9/2006 Lecture 6 – String Processing.
Bash Scripting CIRC Summer School 2016 Baowei Liu CIRC Summer School 2016 Baowei Liu.
Lesson 5-Exploring Utilities
Unix Scripting Session 1 March 6, 2008.
CIRC Winter Boot Camp 2017 Baowei Liu
Department of Computer Engineering
SUSE Linux Enterprise Desktop Administration
CSCE 742 Software Architectures
California State University Fresno
Scripting Languages Info derived largely from Programming Language Pragmatics, by Michael Scott.
Looking for Patterns - Finding them with Regular Expressions
The Linux Operating System
PROGRAMMING THE BASH SHELL PART IV by İlker Korkmaz and Kaya Oğuz
Henning Schulzrinne Advanced Programming
What is Bash Shell Scripting?
LING 408/508: Computational Techniques for Linguists
CSC 140: Introduction to IT
Guide To UNIX Using Linux Third Edition
The Linux Command Line Chapter 24
Unix Talk #2 (sed).
Shell Programming.
Linux Shell Script Programming
Lab 4: Introduction to Scripting
Introduction to Bash Programming, part 3
The Linux Command Line Chapter 24
Presentation transcript:

Scripting Tools, languages and the Shell intERLab at AIT Network Management Workshop March 11-15 – Bangkok, Thailand Hervey Allen

Languages Interpreted bash/sh, Perl, PHP, Python, Ruby Compiled C, C++, Java

Tools sed: Stream EDitor awk: Pattern scanning & processing dc : Arbitrary precision calculator bc: Arbitrary precision calculator language. tr: Translate or delete characters grep: Print lines matching a pattern

The Shell (bash) export printenv ~/.bashrc ~/.profile /etc/profile /etc/bash.bashrc /etc/skel (in Ubuntu)

The Shell cont. By default, on Ubuntu, we use the Bourne Again SHell, or BASH. The shell is your interface to the kernel. Programs use the shell to determine their environment. Your shell environment can be customized. We'll go over how it's configured in Ubuntu.

Using the Shell Command Line Interpreter or CLI To understand scripts let's practice a bit with the CLI. At the shell prompt try: # cd; echo “Hello, World” > test.txt; cp test.txt test.txt.bak; vi test.txt The above is all on one line. What happened? Now try this: # cp test.txt $( date +%F )test.txt

Using the Shell In a file Now create a new file and place the some of our previous command in it: # cd # vi newscript echo “Hello world” > hello.txt cp hello.txt hello.txt.bak cat hello.txt+hello.txt.bak > new.txt cat new.txt :wq

Using the Shell In a file Now we can execute those commands in the order in which they appear in the file by doing this: # bash newscript # sh newscript # . newscript

Using the Shell As a shell script Now we can take the last step and start to create self-contained scripts that run on their own. We'll need to do two things: 1. Specify the CLI to use, and 2. Make our file executable

The “Shebang”

What's Next? Now that you have a very simple shell script working, let's

Strengths

Weaknesses

Core Shell Concepts

Environment

Variables

Control Statements

Exiting

Using External Programs

Perl

Strengths

Weaknesses

How to Run

Variables

Control Statements

Regular Expressions

SNMP with Perl

PHP

LAMP: Linux, Apache, MySQL and PHP Incredibly popular (cite number)

Example: