Learn Linux Shell Scripting – Fundamentals of Bash 4.4: A comprehensive guide to automating administrative tasks with the Bash shell

Sebastiaan Tammer

  • 出版商: Packt Publishing
  • 出版日期: 2018-12-31
  • 售價: $1,810
  • 貴賓價: 9.5$1,720
  • 語言: 英文
  • 頁數: 452
  • 裝訂: Paperback
  • ISBN: 1788995597
  • ISBN-13: 9781788995597
  • 相關分類: Command LineLinux
  • 海外代購書籍(需單獨結帳)

相關主題

商品描述

Create and maintain powerful Bash scripts for automation and administration.

Key Features

  • Get up and running with Linux shell scripting using real-world examples
  • Leverage command-line techniques and methodologies to automate common yet complex administration tasks
  • A practical guide with exposure to scripting constructs and common scripting patterns

Book Description

Shell scripts allow us to program commands in chains and have the system execute them as a scripted event, just like batch files. This book will start with an overview of Linux and Bash shell scripting, and then quickly deep dive into helping you set up your local environment, before introducing you to tools that are used to write shell scripts. The next set of chapters will focus on helping you understand Linux under the hood and what Bash provides the user. Soon, you will have embarked on your journey along the command line. You will now begin writing actual scripts instead of commands, and will be introduced to practical applications for scripts. The final set of chapters will deep dive into the more advanced topics in shell scripting. These advanced topics will take you from simple scripts to reusable, valuable programs that exist in the real world. The final chapter will leave you with some handy tips and tricks and, as regards the most frequently used commands, a cheat sheet containing the most interesting flags and options will also be provided.

After completing this book, you should feel confident about starting your own shell scripting projects, no matter how simple or complex the task previously seemed. We aim to teach you how to script and what to consider, to complement the clear-cut patterns that you can use in your daily scripting challenges.

What you will learn

  • Understand Linux and Bash basics as well as shell scripting fundamentals
  • Learn to write simple shell scripts that interact with Linux operating system
  • Build, maintain, and deploy scripts in a Linux environment
  • Learn best practices for writing shell scripts
  • Avoid common pitfalls associated with Bash scripting
  • Gain experience and the right toolset to write your own complex shell scripts

Who this book is for

This book targets new and existing Linux system administrators, Windows system administrators or developers who are interested in automating administrative tasks. No prior shell scripting experience is needed but in case you do this book will make a pro quickly. Readers should have a basic understanding of the command line.

Table of Contents

  1. Introduction
  2. Setting up your local environment
  3. Choosing the right tools
  4. The Linux filesystem
  5. Understanding the Linux permissions scheme
  6. File manipulation
  7. Hello World!
  8. Variables and user input
  9. Error checking and handling
  10. Regular expressions
  11. Conditional testing and scripting loops
  12. Using pipes and redirection in scripts
  13. Functions
  14. Scheduling and logging
  15. Parsing Bash script arguments with getopts
  16. Bash parameter substitution and expansion
  17. Tips & tricks (with cheat sheet)

商品描述(中文翻譯)

建立和維護強大的 Bash 腳本以進行自動化和管理。

主要特點
- 使用實際範例快速上手 Linux shell 腳本
- 利用命令行技術和方法自動化常見但複雜的管理任務
- 實用指南,涵蓋腳本構造和常見腳本模式

書籍描述
Shell 腳本允許我們將命令鏈接起來,並讓系統作為腳本事件執行它們,就像批次檔一樣。本書將從 Linux 和 Bash shell 腳本的概述開始,然後迅速深入幫助您設置本地環境,接著介紹用於編寫 shell 腳本的工具。接下來的章節將專注於幫助您了解 Linux 的底層運作以及 Bash 為用戶提供的功能。不久之後,您將開始您的命令行之旅。您將開始編寫實際的腳本,而不是僅僅輸入命令,並將接觸到腳本的實際應用。最後一組章節將深入探討 shell 腳本中的更高級主題。這些高級主題將帶您從簡單的腳本轉變為可重用的、有價值的實際程序。最後一章將提供一些實用的提示和技巧,並針對最常用的命令,還將提供一份包含最有趣的標誌和選項的備忘單。

完成本書後,您應該對開始自己的 shell 腳本項目充滿信心,無論之前的任務看起來多麼簡單或複雜。我們的目標是教您如何編寫腳本以及需要考慮的事項,以補充您在日常腳本挑戰中可以使用的明確模式。

您將學到的內容
- 理解 Linux 和 Bash 基礎知識以及 shell 腳本的基本原則
- 學習編寫與 Linux 操作系統互動的簡單 shell 腳本
- 在 Linux 環境中構建、維護和部署腳本
- 學習編寫 shell 腳本的最佳實踐
- 避免與 Bash 腳本相關的常見陷阱
- 獲得經驗和正確的工具集,以編寫自己的複雜 shell 腳本

本書適合誰
本書針對新手和現有的 Linux 系統管理員、Windows 系統管理員或有興趣自動化管理任務的開發人員。無需先前的 shell 腳本經驗,但如果您有,這本書將迅速讓您成為專家。讀者應具備基本的命令行理解。

目錄
1. 介紹
2. 設置本地環境
3. 選擇合適的工具
4. Linux 檔案系統
5. 理解 Linux 權限機制
6. 檔案操作
7. Hello World!
8. 變數和用戶輸入
9. 錯誤檢查和處理
10. 正則表達式
11. 條件測試和腳本循環
12. 在腳本中使用管道和重定向
13. 函數
14. 排程和日誌記錄
15. 使用 getopts 解析 Bash 腳本參數
16. Bash 參數替換和擴展
17. 提示與技巧(附備忘單)