Mastering Linux shell scripting master the complexities of Bash shell scripting and unlock the power of shell for your enterprise

Master the complexities of Bash shell scripting and unlock the power of shell for your enterprise About This Book Identify the high level steps such as verifying user input, using command lines and conditional statements in creating and executing simple shell scripts Create and edit dynamic shell sc...

Descripción completa

Detalles Bibliográficos
Otros Autores: Mallett, Andrew, author (author)
Formato: Libro electrónico
Idioma:Inglés
Publicado: Birmingham : Packt Publishing 2015.
Edición:1st edition
Colección:Community experience distilled
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009629902306719
Tabla de Contenidos:
  • Cover ; Copyright; Credits; About the Author; About the Reviewer; www.PacktPub.com; Table of Contents; Preface; Chapter 1: What and Why of Scripting with Bash ; Bash vulnerabilities; The bash command hierarchy; Command type; Command PATH; Preparing text editors for scripting; Configuring vim; Configuring nano; Configuring gedit; Creating and executing scripts; Hello World!; Executing the script; Checking the exit status; Ensuring a unique name; Hello Dolly!; Running the script with arguments; The importance of correct quotes; Printing the script name; Debugging your scripts; Summary
  • Chapter 2: Creating Interactive Scripts Using echo with options; Basic script using read; Script comments; Enhancing scripts with read prompts; Limiting the number of entered characters; Controlling the visibility of entered text; Enhancing learning with simple scripts; Backing-up with scripts; Connecting to a server; Version 1 - ping; Version 2 - SSH; Version 3 - MySQL/MariaDB; Summary; Chapter 3: Conditions Attached ; Simple decision paths using command-line lists; Verifying user input with lists; Using the test shell builtin; Testing strings; Testing integers; Testing file types
  • Creating conditional statements using ifExtending if with else; More conditions with elif; Creating the backup2.sh using elif; Using case statements; Recipe - building a front-end with grep; Summary; Chapter 4: Creating Code Snippets ; Abbreviations; Using code snippets; Bringing color to the terminal; Summary; Chapter 5: Alternative Syntax ; Recapping test; Testing files; Adding logic; Square brackets as not seen before; Providing parameter defaults; Variables; Special parameters; Setting defaults; When in doubt - Quote!; Advanced test using [[; Whitespace; Other advanced features
  • Pattern matchingRegular expressions; Regular expression script; Arithmetic operations using ((; Simple math; Parameter manipulation; Standard arithmetic tests; Summary; Chapter 6: Iterating with Loops ; For loops; Controlling the loop; While loops and until loops; Reading input from files; Creating operator menus; Summary; Chapter 7: Creating Building Blocks with Functions ; Introducing functions; Passing parameters to functions; Returning values from functions; Using functions in menus; Summary; Chapter 8: Introducing sed ; Using grep to display text
  • Displaying received data on an interfaceDisplaying user account data; Listing the number of CPUs in a system; Parsing CSV files; The CSV file; Isolating catalog entries; Using regular expressions; Working with alternate spellings; How many words have four consecutive vowels?; RE anchors; Understanding the basics of sed; Substituting command; Editing the file; Summary; Chapter 9: Automating Apache Virtual Hosts ; Apache name-based Virtual Hosts; Creating the Virtual Hosts template; First steps; Isolating lines; sed script files; Automating Virtual Host creation
  • Prompting for data during site creation