Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Mastering Linux Shell Scripting

You're reading from   Mastering Linux Shell Scripting Master the complexities of Bash shell scripting and unlock the power of shell for your enterprise

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher
ISBN-13 9781784396978
Length 198 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Andrew Mallett Andrew Mallett
Author Profile Icon Andrew Mallett
Andrew Mallett
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Mastering Linux Shell Scripting
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. What and Why of Scripting with Bash FREE CHAPTER 2. Creating Interactive Scripts 3. Conditions Attached 4. Creating Code Snippets 5. Alternative Syntax 6. Iterating with Loops 7. Creating Building Blocks with Functions 8. Introducing sed 9. Automating Apache Virtual Hosts 10. Awk Fundamentals 11. Summarizing Logs with Awk 12. A Better lastlog with Awk 13. Using Perl as a Bash Scripting Alternative 14. Using Python as a Bash Scripting Alternative Index

Index

A

  • abbreviations
    • about / Abbreviations
    • using / Abbreviations
  • advanced test
    • double [[ bracket used / Advanced test using [[
  • Apache
    • name based Virtual HostsTopicnabout / Apache name-based Virtual Hosts
    • name based Virtual HostsTopicncreating / Apache name-based Virtual Hosts
  • Apache name based Virtual Hosts templates
    • creating / Creating the Virtual Hosts template
    • creating, steps / First steps
    • lines, isolating / Isolating lines
    • sed script files / sed script files
  • Apache Virtual Hosts / Apache Virtual Hosts
  • argument identifier
    • $0 / Running the script with arguments
    • $1 / Running the script with arguments
    • ${10} / Running the script with arguments
    • $# / Running the script with arguments
    • $* / Running the script with arguments
  • arguments, Python
    • about / Pythonic arguments
    • supplying / Supplying arguments
    • counting / Counting arguments
  • arithmetic operations, double (( brackets used
    • about / Arithmetic operations using ((
    • simple maths / Simple math
    • parameter manipulation / Parameter manipulation
    • standard arithmetic tests / Standard arithmetic tests
  • arrays, Perl
    • about / Perl arrays
    • program name, accessing / Program name?
    • argument arrays / Argument arrays
    • elements, counting / Counting elements in an array
    • looping through / Looping through an array
    • creating / Creating arrays
  • awk command
    • history / The history behind awk
  • awk control file
    • about / Awk control files
    • example / Awk control files
  • awk ranges
    • for excluding data / Using awk ranges to exclude data
    • lastlog command / The lastlog command
    • rows, horizontal filtering / Horizontal filtering rows with awk
    • matched rows, counting / Counting matched rows
  • awk record separator, manipulating
    • for reporting on XML data / Manipulating the awk record separator to report on XML data
    • Apache Virtual Hosts / Apache Virtual Hosts
    • XML Catalog / XML catalog

B

  • backup2.sh
    • creating, with elif keyword / Creating the backup2.sh using elif
  • bash
    • vulnerabilities / Bash vulnerabilities
    • about / Bash vulnerabilities
    • command hierarchy / The bash command hierarchy
  • bash command hierarchy
    • about / The bash command hierarchy
    • command type / Command type
    • command PATH / Command PATH
  • basic script
    • creating, with read command / Basic script using read
  • browser data
    • displaying / Displaying the browser data

C

  • case statements
    • using / Using case statements
  • code snippets
    • using / Using code snippets
    • colors, providing for message interpretation / Bringing color to the terminal
  • command
    • types / Command type
  • command-line lists
    • used, for creating simple decision / Simple decision paths using command-line lists
    • used, for verifying user input / Verifying user input with lists
  • conditional statement, Perl
    • about / Conditional statements in Perl
    • command line lists, replacing / Replacing command line lists
    • if keyword / If and unless
    • unless keyword / If and unless
  • conditional statements
    • creating, with if statement / Creating conditional statements using if
  • conditions, based on number of fields / Conditions based on the number of fields
  • content
    • displaying, from files / Displaying and filtering content from files
    • filtering, from files / Displaying and filtering content from files
  • CPUs
    • listing, in system / Listing the number of CPUs in a system
  • CSV files
    • parsing / Parsing CSV files, The CSV file
    • about / The CSV file
    • Isolate Catalog entries / Isolating catalog entries

D

  • data
    • displaying, from Web logs / Displaying data from web logs
  • double [[ bracket
    • using / Advanced test using [[
    • whitespace / Whitespace
    • advanced features / Other advanced features
    • pattern matching / Pattern matching
    • regular expressions / Regular expressions
    • regular expression recipe / Regular expression script

E

  • 404 errors
    • summarizing / Summarizing 404 errors
  • e-mail logs
    • working with / Working with e-mail logs
  • echo command
    • using, with options / Using echo with options
  • elif keyword
    • using / More conditions with elif
    • used, for creating backup2.sh / Creating the backup2.sh using elif
  • else keyword
    • used, for extending if condition / Extending if with else
  • entered text visibility
    • controlling / Controlling the visibility of entered text
  • entries
    • selecting, by date / Selecting entries by date

F

  • files
    • testing / Testing files
    • input, reading / Reading input from files
    • content, displaying / Displaying and filtering content from files
    • content, filtering / Displaying and filtering content from files
    • writing, with Python / Using Python to write to files
  • file types
    • testing / Testing file types
  • for loops
    • about / For loops
    • executing / For loops
  • front-end
    • building, with grep command / Script – building a front-end with grep
  • functions
    • about / Introducing functions
    • parameters, passing to / Passing parameters to functions
    • values, returning from / Returning values from functions
    • using, in menus / Using functions in menus
    • using, with Perl / Using functions within Perl
    • prompting, for user input / Prompt for user input
    • creating / Creating the function

G

  • gedit
    • configuring / Configuring gedit
  • grep command
    • used, for building front-end / Script – building a front-end with grep
    • used, for displaying text / Using grep to display text

H

  • Hello Dolly!
    • about / Hello Dolly!
    • script, running with arguments / Running the script with arguments
    • correct quotes, importance / The importance of correct quotes
  • Hello World! script
    • about / Hello World!
  • Hello World, Python
    • writing / Saying Hello World the Python way
  • Hello World script, Perl
    • creating / Hello World
  • highest ranking IP address
    • displaying / Displaying the highest ranking IP address
  • HTTP access codes
    • summarizing / Summarizing HTTP access codes
  • HTTPD log file format
    • about / The HTTPD log file format
    • fields / The HTTPD log file format

I

  • if condition
    • extending, with else keyword / Extending if with else
  • if statement
    • used, for creating conditional statements / Creating conditional statements using if
  • input
    • reading, from files / Reading input from files
  • integers
    • testing / Testing integers
  • interface
    • received data, displaying / Displaying received data on an interface

L

  • lines
    • isolating / Isolating lines
  • logic
    • adding / Adding logic
  • loop
    • controlling / Controlling the loop
    • until loops / While loops and until loops
    • while loops / While loops and until loops

M

  • menus
    • functions, using / Using functions in menus
  • MySQL/MariaDB database server / Version 3 – MySQL/MariaDB

N

  • named elements / Introducing functions
  • nano
    • configuring / Configuring nano
  • number of entered characters
    • limiting / Limiting the number of entered characters

O

  • operator menus
    • creating / Creating operator menus
  • options, vim configuration
    • showmode / Configuring vim
    • nohlsearch / Configuring vim
    • autoindent / Configuring vim
    • tabstop=4 / Configuring vim
    • expandtab / Configuring vim
    • syntax on / Configuring vim
  • output
    • formatting / Formatting output

P

  • parameter defaults
    • providing / Providing parameter defaults
    • variables / Variables
    • special parameters / Special parameters
    • setting / Setting defaults
  • parameter expansion / When in doubt – Quote!
  • parameters
    • quoting / When in doubt – Quote!
    • passing, to functions / Passing parameters to functions
  • Perl
    • about / What is Perl?
    • script, creating / Hello World
    • arrays / Perl arrays
    • conditional statement / Conditional statements in Perl
    • functions, using with / Using functions within Perl
  • ping command / Version 1 – ping
  • printf function / Formatting output
  • Python
    • about / What is Python?
    • Hello World / Saying Hello World the Python way
    • arguments / Pythonic arguments
    • used, for writing to files / Using Python to write to files

R

  • read command
    • used, for creating basic script / Basic script using read
  • read prompts
    • used, for enhancing scripts / Enhancing scripts with read prompts
  • regular expressions (RE)
    • using / Using regular expressions
    • alternate spellings, working with / Working with alternate spellings
    • words with four consecutive vowels, searching / How many words have four consecutive vowels?
    • anchors / RE anchors

S

  • script comment
    • about / Script comments
  • scripts
    • creating / Creating and executing scripts
    • executing / Creating and executing scripts, Executing the script
    • Hello World! / Hello World!
    • exit status, checking / Checking the exit status
    • unique name, ensuring / Ensuring a unique name
    • Hello Dolly! / Hello Dolly!
    • name, printing / Printing the script name
    • debugging / Debugging your scripts
    • comments / Script comments
    • enhancing, with read prompts / Enhancing scripts with read prompts
  • sed command
    • about / Understanding the basics of sed
    • substituting / Substituting command
    • file, editing with -i option / Editing the file
  • sed script files / sed script files
  • simple decision
    • creating, with command-line lists / Simple decision paths using command-line lists
  • simple scripts
    • building / Enhancing learning with simple scripts
    • backup script / Backing-up with scripts
    • used for connecting to server / Connecting to a server
    • ping command / Version 1 – ping
    • SSH / Version 2 – SSH
    • MySQL/MariaDB / Version 3 – MySQL/MariaDB
  • SSH / Version 2 – SSH
  • strings
    • testing / Testing strings

T

  • test
    • running / Recapping test
    • square brackets / Square brackets as not seen before
  • test shell builtin
    • using / Using the test shell builtin
    • strings, testing / Testing strings
    • integers, testing / Testing integers
    • file types, testing / Testing file types
  • text
    • displaying, with grep command / Using grep to display text
    • received data, displaying on interface / Displaying received data on an interface
    • user account data, displaying / Displaying user account data
    • CPUs, listing in system / Listing the number of CPUs in a system
    • CSV files, parsing / Parsing CSV files
  • text editors
    • preparing, for scripting / Preparing text editors for scripting
    • vim configuration / Configuring vim
    • nano configuration / Configuring nano
    • gedit configuration / Configuring gedit

U

  • until loop
    • about / While loops and until loops
  • user account data
    • displaying / Displaying user account data
  • user input
    • verifying, with command-line lists / Verifying user input with lists
    • reading / Reading user input
  • users
    • filtering, by UID / Further filtering to display users by UID

V

  • values
    • returning, from functions / Returning values from functions
  • vi command
    • col / Abbreviations
  • vim
    • configuring / Configuring vim
  • virtual host creation
    • automating / Automating Virtual Host creation
    • data, prompting for / Prompting for data during site creation

W

  • Web logs
    • data, displaying from / Displaying data from web logs
    • entries, selecting from date / Selecting entries by date
    • 404 errors, summarizing / Summarizing 404 errors
    • HTTP access codes, summarizing / Summarizing HTTP access codes
  • while loop
    • about / While loops and until loops
  • white-space / Significant whitespace

X

  • XML Catalog / XML catalog
lock icon The rest of the chapter is locked
arrow left Previous Section
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime
Visually different images
Modal Close icon
Modal Close icon