Shell Advanced Features. Module 8 Shell Advanced Features ♦ Introduction In Linux systems, the shells are often referred to as command line interfaces.

Slides:



Advertisements
Similar presentations
EMT 2390L Lecture 4 Dr. Reyes Reference: The Linux Command Line, W.E. Shotts.
Advertisements

Using Linux Commands Lab 4 1. Create empty files To create an empty file $ touch apple banana grape grapefruit watermelon $ ls -l Using file-matching.
7 Searching and Regular Expressions (Regex) Mauro Jaskelioff.
CS 497C – Introduction to UNIX Lecture 22: - The Shell Chin-Chih Chang
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Shell Basics CS465 - Unix. Shell Basics Shells provide: –Command interpretation –Multiple commands on a single line –Expansion of wildcard filenames –Redirection.
UNIX chapter 04 UNIX Shells Mr. Mohammad Smirat. Introduction The shell is the software that listens to commands typed in at the terminal and translates.
Now, return to the Unix Unix shells: Subshells--- Variable---1. Local 2. Environmental.
23-Jun-15Advanced Programming Spring 2002 bash Henning Schulzrinne Department of Computer Science Columbia University.
CS 497C – Introduction to UNIX Lecture 20: - The Shell Chin-Chih Chang
Chapter 5 Accessing Files and Directories. How Directories Get Created OS installation: usr, dev, etc, export, kernel and others places to store installation.
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
CMPE 151: Network Administration Spring Class Description Focus: system and network administration. Sequence of exercises. E.g., installing/configuring.
QUOTATION This chapter teaches you about a unique feature of the shell programming language: the way it interprets quote characters. Basically, the shell.
Using Linux Commands Lab 4. Using the Shell in Linux Commands Syntax  Options: could be added to the commands to change their behavior (-a, -la, --help)
Shell Script Examples.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Introduction to Shell Script Programming
1 Operating Systems Lecture 3 Shell Scripts. 2 Shell Programming 1.Shell scripts must be marked as executable: chmod a+x myScript 2. Use # to start a.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
An Introduction to Unix Shell Scripting
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 8 Shell.
The UNIX Shell. The Shell Program that constantly runs at terminal after a user has logged in. Prompts the user and waits for user input. Interprets command.
Shell Features CSCI N321 – System and Network Administration Copyright © 2000, 2005 by Scott Orr and the Trustees of Indiana University.
Computer Programming for Biologists Oct 30 th – Dec 11 th, 2014 Karsten Hokamp  Fill out.
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
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.
Additional UNIX Commands. 222 Lecture Overview  Multiple commands and job control  More useful UNIX utilities.
File Permission and Access. Module 6 File Permission and Access ♦ Introduction Linux is a multi-user system where users can assign different access permission.
OPERATING SYSTEMS DESIGN UNIX BASICS & SHELL SCRIPTING.
Introduction to Bash Programming Ellen Zhang. Previous three classes What have we learnt so far ?
UNIX Shell Script (1) Dr. Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology
Workbook 6 – Part 2 The Bash Shell
Process Control. Module 11 Process Control ♦ Introduction ► A process is a running occurrence of a program, including all variables and other conditions.
Agenda Regular Expressions (Appendix A in Text) –Definition / Purpose –Commands that Use Regular Expressions –Using Regular Expressions –Using the Replacement.
Managing Files. Module 5 Managing Files ♦ Introduction “On a Linux system, everything is a file; if something is not a file, it is a process.” ♦ Topics.
Creating and Managing File Systems. Module 5 – Creating and Managing File Systems ♦ Overview This module deals with the structure of the file system,
8-2 What is a program? What is a “Window Manager” ? What is a “GUI” ? How do you navigate the Unix directory tree? What is a wildcard? Readings: See CCSO’s.
©Colin Jamison 2004 Shell scripting in Linux Colin Jamison.
Chapter Six Introduction to Shell Script Programming.
Manage Directories and Files in Linux Part 2. 2 Identify File Types in the Linux System The file types in Linux referred to as normal files and directories.
Using Linux Commands Lab 4. Using the Shell in Linux Commands Syntax  Options: could be added to the commands to change their behavior (-a, -la, --help)
Introduction to Unix (CA263) Quotes By Tariq Ibn Aziz.
CSCI 330 UNIX and Network Programming Unit IV Shell, Part 2.
Awk- An Advanced Filter by Prof. Shylaja S S Head of the Dept. Dept. of Information Science & Engineering, P.E.S Institute of Technology, Bangalore
CSCI 330 UNIX and Network Programming Unit IV Shell, Part 2.
Module 1 - Introduction to Linux. Users must log-in Linux is case sensitive File and Directories naming conventions (No spaces!) Files and Directories.
Agenda The Bourne Shell – Part II Special Characters Ambiguous File Reference Variable Names and Values User Created Variables Read-only Variables (Positional.
Introduction to Unix (CA263) Command File By Tariq Ibn Aziz.
Isecur1ty training center Presented by : Eng. Mohammad Khreesha.
1 © 2001 John Urrutia. All rights reserved. Chapter 2 Getting Started.
1 © 2012 John Urrutia. All rights reserved. Chapter 09 The TC Shell.
Lesson 8-Specifying Instructions to the Shell. Overview An overview of shell. Execution of commands in a shell. Shell command-line expansion. Customizing.
1 Lecture 7 Introduction to Shell Scripts COP 3353 Introduction to UNIX.
Unix Lab Fall Shell Scripting ●Through the shell (LXTerminal) you can: ●Run programs. ●Interact with the file system. ●Change settings. ●Send/receive.
Shell scripts – part 1 Cs 302. Shell scripts  What is Shell Script? “Shell Script is series of command written in plain text file. “  Why to Write Shell.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
1 Lecture 8 Shell Programming – Control Constructs COP 3353 Introduction to UNIX.
SUSE Linux Enterprise Desktop Administration
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Shell Features CSCI N321 – System and Network Administration
Using Linux Commands Lab 3.
The Linux Command Line Chapter 2
John Carelli, Instructor Kutztown University
The Linux Command Line Chapter 7
Module 6 Working with Files and Directories
Presentation transcript:

Shell Advanced Features

Module 8 Shell Advanced Features ♦ Introduction In Linux systems, the shells are often referred to as command line interfaces. The shell capabilities provide a configurable environment allowing the users to modify commands and prompts. ♦ Topics ► Shell Substitution Capabilities ► Setting Shell Variables ► Quoting Characters ► File Name Generationss

Shell Advanced Features Shell Substitution Capabilities ♦ Substitution capabilities are used to speed up command line typing and execution. ♦ The shell substitutions are of three types: ► Variable Substitution ► Command substitution ► Tilde Substitution Contd…

Shell Advanced Features Shell Substitution Capabilities ♦ Variable Substitution ► Variable substitution is assigning the absolute path of a file or directory to any variable. This allows the user to access the directory or file from anywhere in the file hierarchy. Syntax: =$ Example: myfile=$HOME/file1 Contd…

Shell Advanced Features Shell Substitution Capabilities ♦ Command substitution ► Command substitution is the mechanism used to replace a command with its output, within the same command line. Syntax: =$(command) Example: mydir=$ (pwd) Contd…

Shell Advanced Features ♦ Tilde Substitution A tilde is replaced for the quick reference of home directory. Syntax: ~ Example: ls ~ Shell Substitution Capabilities

Shell Advanced Features ♦ The new variable can be created and assigned to an existing environmental variable such as path. ♦ The new value replaces the old value in the environment and the same can be displayed by using the display value commands. Syntax = Example myfile_name=/root/file1 Contd… Setting Shell Variables

Shell Advanced Features Setting Shell Variables ♦ Displaying variable values ► The variables can be displayed by using $. ► It can be local variable (assigned by the user) or environmental variable (default variable). ► All setting variables can be displayed by using the command set.

Shell Advanced Features Quoting Characters ♦ There are some characters in the Unix system and each has the meaning for the shell and is called as special characters. The special characters are: ► - ► $ ► # ► * ► ♦ Quoting removes the special meaning of the above characters. The quoting characters are: ► \ Backslash ► ‘ ’ Single quotes ► “ ” Double quotes Contd…

Shell Advanced Features Contd… ♦ Backslash ( \ ) Backslash removes the special meaning of the character immediately following the backslash. Quoting Characters

Shell Advanced Features ♦ Single quotes ( ‘ ’) The single quote is used to preserve the literal value of special character enclosed within the quotes. Contd… Quoting Characters

Shell Advanced Features Quoting Characters ♦ Double quotes ( “ ” ) Double quotes removes the special meaning of all the characters except \, $ (variable name), $ (command).

Shell Advanced Features ♦ The file name generation has the timesaving feature for typing the filenames. This feature is called file name generation or filename expansion. ► Advantages of file name generation File name generating characters are interpreted by the shell. The command operates on the generated file names. The shell will generate file names that satisfy the requested pattern. File name generation is done before the command is executed. ♦ The special characters that are interpreted by the shell for file name generation are: ? Matches any single character except a leading dot * Matches zero or more characters except a leading dot Contd… File Name Generation

Shell Advanced Features File Name Generation ♦ Usage of the special character ‘?’ Contd…

Shell Advanced Features File Name Generation ♦ Usage of the special character ‘*’

Shell Advanced Features Lab Exercise ♦ Give one example on usage of single quotes command with the variable substitution ♦ Display the files which has 9 characters and with the extension.jpg