万本电子书0元读

万本电子书0元读

顶部广告

Mastering Bash电子书

售       价:¥

5人正在读 | 0人评论 9.8

作       者:Giorgio Zarrelli

出  版  社:Packt Publishing

出版时间:2017-07-07

字       数:62.8万

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

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

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Your one stop guide to making the most out of Bash programming About This Book ? From roots to leaves, learn how to program in Bash and automate daily tasks, pouring some spice in your *s ? Daemonize a * and make a real service of it, ensuring it’s available at any time to process user-fed data or commands ? This book provides functional examples that show you practical applications of commands Who This Book Is For If you're a power user or system administrator involved in writing Bash *s to automate tasks, then this book is for you. This book is also ideal for advanced users who are engaged in complex daily tasks. What You Will Learn ? Understand Bash right from the basics and progress to an advanced level ? Customise your environment and automate system routine tasks ? Write structured *s and create a command-line interface for your *s ? Understand arrays, menus, and functions ? Securely execute remote commands using ssh ? Write Nagios plugins to automate your infrastructure checks ? Interact with web services, and a Slack notification * ? Find out how to execute subshells and take advantage of parallelism ? Explore inter-process communication and write your own daemon In Detail System administration is an everyday effort that involves a lot of tedious tasks, and devious pits. Knowing your environment is the key to unleashing the most powerful solution that will make your life easy as an administrator, and show you the path to new heights. Bash is your Swiss army knife to set up your working or home environment as you want, when you want. This book will enable you to customize your system step by step, making your own real, virtual, home out of it. The journey will take you swiftly through the basis of the shell programming in Bash to more interesting and challenging tasks. You will be introduced to one of the most famous open source monitoring systems—Nagios, and write complex programs with it in any languages. You’ll see how to perform checks on your sites and applications. Moving on, you’ll discover how to write your own daemons so you can create your services and take advantage of inter-process communication to let your *s talk to each other. So, despite these being everyday tasks, you’ll have a lot of fun on the way. By the end of the book, you will have gained advanced knowledge of Bash that will help you automate routine tasks and manage your systems. Style and approach This book presents step-by-step instructions and expert advice on working with Bash and writing *s. Starting from the basics, this book serves as a reference manual where you can find handy solutions and advice to make your *s flexible and powerful.
目录展开

Title Page

Copyright

Mastering Bash

Credits

About the Author

About the Reviewer

www.PacktPub.com

Customer Feedback

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

Let's Start Programming

I/O redirection

Messing around with stdin, stdout, and stderr

Time for the interpreter: the sha-bang

Calling your script

Something went wrong, let's trace it

Variables

Assigning a variable

Keep the variable name safe

Variables with limited scope

Environment variables

Variable expansion

Pattern matching against variables

Special variables

Summary

Operators

Arithmetic operators

The + operator

The - operator

The * operator

The / operator

The % operator

The ** operator

Assignment operators

The += operator

The -= operator

The *= operator

The /= operator

The %= operator

The ++ or -- operators

Bitwise operators

Left shift (<<)

Right shift (>>)

Bitwise AND

Bitwise OR (|)

Bitwise XOR (^)

Bitwise NOT (~)

Logical operators

Logical NOT (!)

Logical AND

Logical OR (||)

Comma operator (,)

Operators evaluation order and precedence in decreasing relevance

Exit codes

Exiting a script

Summary

Testing

What if...else

Test command recap

Testing files

Testing integers

Testing strings

More on tests

Summary

Quoting and Escaping

Special characters

The hash character (#)

The semicolon character (;)

The double semicolon character (;;)

The case terminator (;;&) and (;&))

The dot character (.)

The double quotes ("...")

The single quotes ('...')

The comma character (,)

The ,, and , () case modificators

The ^^ and ^ () case modificators

The backslash (\)

The forward slash (/)

'...'

The colon character (:)

The exclamation (!)

Keywords

The asterisk (*)

The double asterisk (**)

Test operators (?)

The substitution ($)

The parameter substitution (${})

The quoted string expansion ($'...')

The positional parameters ($* and $")

The exit status ($?)

The process ID ($$)

Grouping the command (command1 ; command2 ; commandn)

Braces ({})

The full path ({} \;)

Expression ([])

Expression ([[]])

The array index ([])

Characters range ([])

Integer expansion ($[…])

Integer expansion (((..)))

DEMO

The here document (<<)

The here string (<<<)

The ASCII comparison operators (<) and (>)

Delimiters (\< and \>)

The pipe character (|)

The force redirection (>|)

The logical OR (||)

DEMO

Logical AND

The dash character (-)

The double dash (--)

Operator =

Operator +

The modulo operator (%)

Operator ~

Operator ~+

Operator ~-

Operator ~=

Operator ^

The control characters (^ and ^^)

Quoting and escaping

The backslash (\)

Double quotes ("")

Single quotes (')

Summary

Menus, Arrays, and Functions

The case statement

Arrays

Functions

Summary

Iterations

The for loop

Let's do something while, until…

Exiting the loop with break and continue

Time to give our client a menu

CLI, passing the arguments to the command line

Summary

Plug into the Real World

What is Nagios?

Active and passive checks

Active checks

Passive checks

Returning code and thresholds

Command and service definitions

Our first Nagios plugin

Summary

We Want to Chat

The Slack messaging service

Slack WebHooks

What is a JSON?

Do you like cURLing?

Formatting our messages

Message attachments

Our wee chatty script for Slack

Summary

Subshells, Signals, and Job Controls

What is a subshell?

Background processes

Signals

Job controls

Subshells and parallel processing

Summary

Lets Make a Process Chat

Pipes

Redirection to a file

The command substitution

The process substitution

Environment variables

Coprocesses

/dev/tcp and /dev/udp

Netcat

Summary

Living as a Daemon

What is a daemon?

DEMO

nohup

disown

Double fork and setsid

Becoming a daemon

Trapping a daemon

Going dark with the daemon

Summary

Remote Connections over SSH

What is SSH?

Configuration files

The sshd_config file

ssh_config

Passwordless connections

Configuring the server

Preparing the remote account

Configuring the client

Proxies and tunnels

Summary

Its Time for a Timer

One shot at it

The cron scheduler

cron

Summary

Time for Safety

The restricted shell

Restricted shells for OpenSSH

Restricted sftp sessions with OpenSSH

Summary

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

发表评论

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

买过这本书的人还买过

读了这本书的人还在读

回顶部