Shell Scripting Introduction. Agenda What is Shell Scripting? Why use Shell Scripting? Writing and Running a Shell Script Basic Commands -ECHO - REM.

Slides:



Advertisements
Similar presentations
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Advertisements

1. Chapter 29 Creating Forms 3 Understanding Forms Word enables you to create fill-in forms to eliminate the need for storing pre-printed forms. Add.
Using Macros and Visual Basic for Applications (VBA) with Excel
Developing an Excel Application
Tutorial 8: Developing an Excel Application
Tutorial 12: Enhancing Excel with Visual Basic for Applications
Scripts and Flow Control. Scripts So far we have been entering commands directly into the command line But there is a better way Script files (and functions)
Using the Visual Basic Editor Visual Basic for Applications 1.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Word Project 8 Working with Macros and Visual Basic for Applications (VBA)
Creating a Console Application with Visual Studio
Exploring Microsoft Excel 2002 Chapter 8 Chapter 8 Automating Repetitive Tasks: Macros and Visual Basic for Applications By Robert T. Grauer Maryann Barber.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Ch 111 Chapter 11 Advanced Batch Files. Ch 112 Overview This chapter focuses on batch file commands that allow you to:  write sophisticated batch files.
Ch 101 Introduction to Batch Files. Ch 102 Overview Will learn to create batch files to automate a sequence of commands to accomplish various tasks.
Or CMD/BATCH.  Title this comand makes the cmd prompt’s title whatever you would like it to be.
Programming For Nuclear Engineers Lecture 12 MATLAB (3) 1.
Lecture 1: Introduction Lecture series based on the text: Essential MATLAB for Engineers and Scientists By Hahn & Valentine
MATLAB File Management. MATLAB User File Management Matlab provides a group of commands to manage user files. For more information, type help iofun. pwd.
Web Design Using HTML Codes. WHAT DO I NEED TO BEGIN DESIGNING A HOME PAGE? 1.YOU NEED A FOLDER (also called a DIRECTORY) You should set up a folder or.
1 Guide to Novell NetWare 6.0 Network Administration Chapter 12.
Project 9 Using Visual Basic for Applications (VBA) to Customize and Automate Excel Jason C. H. Chen, Ph.D. Professor of Management Information Systems.
1 CA201 Word Application Increasing Efficiency Week # 13 By Tariq Ibn Aziz Dammam Community college.
Copyright 2007, Paradigm Publishing Inc. EXCEL 2007 Chapter 7 BACKNEXTEND 7-1 LINKS TO OBJECTIVES Record & run a macro Record & run a macro Save as a macro-
MAIL MERGE Designing Documents with. Terms Mail Merge: A process that inserts variable information into a standardized document to produce a personalized.
PMS /134/182 HEX 0886B6 PMS /39/80 HEX 5E2750 PMS /168/180 HEX 00A8B4 PMS /190/40 HEX 66CC33 By Adrian Gardener Date 9 July 2012.
®® Microsoft Windows 7 for Power Users Tutorial 13 Using the Command-Line Environment.
Ch 101 Chapter 10 Introduction to Batch Files. Ch 102 Overview A batch file is a text file that contains an ordered series of commands.
Batch File Basics Automate repetitive computer processes Friday, March 12, 2014 Presented by Thomas Redd, STS, Granite School District.
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
1 The EDIT Program The Edit program is a full screen text editor that allows you to: Create text files Create text files Edit an existing text files Edit.
Introduction of Geoprocessing Topic 7a 4/10/2007.
Command Prompt Chapter 10 Introduction to Batch Files Richard Goldman February 7, 2000.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Just as there are many human languages, there are many computer programming languages that can be used to develop software. Some are named after people,
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Running Modflow with Batch Files. Dos basics cd = change directory (dOs Is NoT cAsE sEnSiTiVe) dir = shows you what is in the directory (It gives you.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 2 – Introduction to the Visual Studio .NET IDE
Lab Assignment 4 Using Batch Files
Chapter 23. Copyright 2003, Paradigm Publishing Inc. CHAPTER 23 BACKNEXTEND 23-2 LINKS TO OBJECTIVES Record, Run, Pause, and Delete Macros Record, Run,
Shell Scripting – Putting it All Together. Agenda Escaping Characters Wildcards Redirecting Output Chaining and Conditional Chaining Unnamed and Named.
File and Folder CLI Commands 12/24/ Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.
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.
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
Creating and Editing a Web Page
© 2015 by McGraw-Hill Education. This proprietary material solely for authorized instructor use. Not authorized for sale or distribution in any manner.
Object-Oriented Application Development Using VB.NET 1 Chapter 2 The Visual Studio.NET Development Environment.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
XP New Perspectives on Microsoft Windows XP Tutorial 2 1 Microsoft Windows XP Working with Files Tutorial 2.
Introduction of Geoprocessing Lecture 9 3/24/2008.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
Word and the Writing Process. To create a document 1.On the Start menu, point to Programs, and then click Microsoft Word. A new document opens in Normal.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Using Macros Lesson.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
Development Environment
Chapter 2 – Introduction to the Visual Studio .NET IDE
Microsoft Excel 2003 Illustrated Complete
Module 1: Getting Started with Windows 95
Exploring Microsoft Excel
12th Computer Science – Unit 5
Running a Java Program using Blue Jay.
Microsoft Excel 2007 – Level 2
Presentation transcript:

Shell Scripting Introduction

Agenda What is Shell Scripting? Why use Shell Scripting? Writing and Running a Shell Script Basic Commands -ECHO - REM - TITLE - COLOR - PAUSE

Shell Scripting are text files of CLI commands must have the CMD or BAT extension execute a batch file by typing its name at the C:\> In Vista, you can execute batch files only from your profile directory C:\users\profileName, unless authenticated as administrator you can use the “Open Command Window Here” by holding the Shift KEY and right clicking on any folder in Explorer you can execute a batch file as administrator by holding the Shift key and right clicking on the executable and choosing “Run as Administrator” dialog box

Why use Shell scripting? Automate repetitive tasks which don’t warrant the time to write a C, C++ program Customizing desktop environment Copying\moving directory trees Renaming groups of files Run a series of procedures with one command Gathering status information and preparing a printed report Create menus and interactive programs to simply the UI Shell scripting is an essential skill of all Windows users to solve programming problems and improve efficiency of the OS

Basic Shell Commands ECHO turns system prompt output on or off and displays messages ECHO ON turns system prompt messages on ECHO OFF turns system prompt messages off ECHO. Creates a blank suppresses the system prompt for a line PAUSE stops execution until user input CLS clears the screen REM prevents execution of a line. Good for comments and debugging

Writing a Shell Script  Use any text editor and save the file with a.cmd  Good programming requires good documentation  Name of file.cmd  Author of the file  Date Last Modified  Purpose of the file  Requirements  White space can be used to make the script easier to read – has not effect on the running of the script  Writing commands in uppercase makes debugging easier, but is not required

Writing a Simple Script Stops system messages Documentation Clears screen Displays message Gives user opportunity to stop execution Stops execution until user presses any key Built in function to stop script execution

Saving Your Script

Running Your Script Command line input: Command line output:

@ECHO OFF, ECHO Example Create the following Shell script file, name it “greeting.cmd”

ECHO. Example Used to create a blank line to improve appearance of the output

REM Example Used to add comments to make the code more readable

CLS Example Used to clear the screen -- prompt at the top of the window

Title Example Used to add text to the title bar

Color Example Changes foreground and background colour

PAUSE Example Used to temporarily stop script execution

Replaceable Parameters A replaceable parameter is a “placeholder” for information entered on the command line and inserted by the command interpreter into the script during run time Unnamed Replacement Parameters Use %1, %2, %3, %4, %5, %6, %7, %8, %9

Unnamed Replacement Parameters Names are “hardwired” in the script – no flexibility No user input before script runs – no dynamic changes Changes to script must be retyped – thus, error prone

Unnamed Replacement Parameters Statements are not “hardwired” – gives flexibility User input on the CLI – allows dynamic changes No retyping of code – thus, less error prone

Unnamed Replacement Parameters