万本电子书0元读

万本电子书0元读

顶部广告

Mastering Linux Shell Scripting电子书

售       价:¥

3人正在读 | 0人评论 9.8

作       者:Andrew Mallett

出  版  社:Packt Publishing

出版时间:2015-12-24

字       数:63.8万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Master the complexities of Bash shell *ing 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 *s Create and edit dynamic shell *s to manage complex and repetitive tasks Learn about *ing in Perl and programming in Python as a BASH *ing alternative with this practical, step-by-step guide Who This Book Is For Mastering Linux Shell Scripting has been written for Linux administrators who want to automate tasks in their daily lives, saving time and effort. You’ll need to have command-line experience and be familiar with the tasks that you need to automate. What You Will Learn Use the type command to identify the order of command evaluation Create interactive *s that prompt for user input Foster menu structures for operators with little command-line experience Develop *s that dynamically edit web configuration files to produce a new virtual host Write *s that use AWK to search and reports on log files Draft effective *s using functions as building blocks, reducing maintenance and build time Make informed choices by comparing different * languages such as Perl and Python with BASH In Detail Shell *ing is a quick method to prototype a complex application or a problem by automating tasks when working on Linux-based systems. Using both simple one-line commands and command sequences complex problems can be solved with ease, from text processing to backing up sysadmin tools. In this book, you’ll discover everything you need to know to master shell *ing and make informed choices about the elements you employ. Get to grips with the fundamentals of creating and running a * in normal mode, and in debug mode. Learn about various conditional statements' code snippets, and realize the power of repetition and loops in your shell *. Implement functions and edit files using the Stream Editor, * in Perl, program in Python – as well as complete coverage of other *ing languages to ensure you can choose the best tool for your project. Style and approach The book will capture your attention and keep you engaged with the simplicity and clarity of each explanation. Every step is accompanied with screen captures so you can cross-check the results before moving on.
目录展开

Mastering Linux Shell Scripting

Table of Contents

Mastering Linux Shell Scripting

Credits

About the Author

About the Reviewer

www.PacktPub.com

Support files, eBooks, discount offers, and more

Why subscribe?

Free access for Packt account holders

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Downloading the color images of this book

Errata

Piracy

Questions

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

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

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 if

Extending if with else

More conditions with elif

Creating the backup2.sh using elif

Using case statements

Script – building a front-end with grep

Summary

4. Creating Code Snippets

Abbreviations

Using code snippets

Bringing color to the terminal

Summary

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 matching

Regular expressions

Regular expression script

Arithmetic operations using ((

Simple math

Parameter manipulation

Standard arithmetic tests

Summary

6. Iterating with Loops

For loops

Controlling the loop

While loops and until loops

Reading input from files

Creating operator menus

Summary

7. Creating Building Blocks with Functions

Introducing functions

Passing parameters to functions

Returning values from functions

Using functions in menus

Summary

8. Introducing sed

Using grep to display text

Displaying received data on an interface

Displaying 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

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

Summary

10. Awk Fundamentals

The history behind awk

Displaying and filtering content from files

Formatting output

Further filtering to display users by UID

Awk control files

Summary

11. Summarizing Logs with Awk

The HTTPD log file format

Displaying data from web logs

Selecting entries by date

Summarizing 404 errors

Summarizing HTTP access codes

Displaying the highest ranking IP address

Displaying the browser data

Working with e-mail logs

Summary

12. A Better lastlog with Awk

Using awk ranges to exclude data

The lastlog command

Horizontal filtering rows with awk

Counting matched rows

Conditions based on the number of fields

Manipulating the awk record separator to report on XML data

Apache Virtual Hosts

XML catalog

Summary

13. Using Perl as a Bash Scripting Alternative

What is Perl?

Hello World

Perl arrays

Program name?

Argument arrays

Counting elements in an array

Looping through an array

Creating arrays

Conditional statements in Perl

Replacing command line lists

If and unless

Using functions within Perl

Prompt for user input

Creating the function

Summary

14. Using Python as a Bash Scripting Alternative

What is Python?

Saying Hello World the Python way

Pythonic arguments

Supplying arguments

Counting arguments

Significant whitespace

Reading user input

Using Python to write to files

Summary

Index

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部