Mastering Shell from Scratch cover

Mastering Shell from Scratch

Rating 4.1
Chapters
37
Series
Shell: From Beginner to Pro
ISBN
9787302338079

Tags

Summary

This book is a Bash Shell programming tutorial in the "Linux Classic Series," written by Zhang Chunxiao, who has long worked in UNIX and Linux system maintenance. It has 15 chapters in three parts. Part 1, "Getting to Know Shell Programming," covers what Shell is, its origins and types, how to create and execute scripts, how to pass arguments to scripts, and how to set up practice environments on Windows, Linux, and FreeBSD, choose editors, and configure the system environment. Part 2, "Shell Programming Fundamentals," systematically explains variables and quoting, conditional tests and judgment statements, loops, functions, arrays, regular expressions, text-processing tools, the stream editor sed, the awk command, file operations, subshells, and process handling. Part 3 moves to practice, covering Shell script debugging techniques and using two comprehensive cases to show how to organize scattered knowledge into usable operations scripts.

The book unfolds through nearly 300 examples, highlighting easily confused and highly practical points, with a chapter summary for review and accompanying instructional videos and other learning resources. The progressive arrangement makes it suitable both for systematic self-study and as a textbook for universities and training courses.

Editor's review

Shell 是 Linux 运维和开发绕不开的一道门槛,而市面上的 Shell 书大多要么只讲命令罗列,要么一上来就是晦涩的语法手册。这本书的好处是“有坡度”:从“为什么学 Shell”和“怎么把环境装好”讲起,先让读者跑通第一个 Hello World 脚本,再逐步进入变量、条件判断、循环、函数、数组这些真正的编程要素,最后才碰正则、sed、awk 这类文本处理重器。作者张春晓长期在暨南大学做 UNIX/Linux 系统维护,示例来自实际工作场景,近 300 个例子让每个语法点都有落脚处;对易混淆之处专门加了提示,避免读者“看得懂、写不出”。每章末尾的小结与配套教学视频,适合自学时自查进度。作为“Linux典藏大系”的一员,它在豆瓣上也拿到了 8.2 分,属于口碑经过读者检验的教材型读物。如果你需要一本能把 Bash 从零星命令串成完整脚本能力的书,它是个稳妥的选择。

Who it's for

A good fit for

  • 需要编写日常运维脚本的 Linux 系统管理员
  • 刚接触 Linux、想系统掌握 Bash 的后端开发人员
  • 把 Shell 课程作为教材的高校教师与相关专业学生
  • 参加各类 Linux 培训班、需要配套讲义与练习的学员

Not a good fit for

  • 零基础、完全没碰过命令行和 Linux 的读者,建议先补入门知识
  • 想专攻 zsh、fish、PowerShell 等非 Bash Shell 的读者
  • 期望直接读到高级内核编程或大规模自动化平台设计的人

Reading tips

  1. 先亲手把第 2 章的环境搭好,边读边敲,不要只做“阅读式学习”
  2. 把近 300 个示例按章节整理成自己的脚本库,改参数改写,观察输出差异
  3. 每章小结与习题不要跳过,能独立写出再来进入下一章
  4. 读完全书后用两个综合案例自己重写一遍,再对照书中实现找差距

About the publisher

Tsinghua University Press China · Founded in 1980

Founded in 1980, Tsinghua University Press has 57 titles in our collection, covering popular science, medicine, health, law, philosophy and social sciences. Representative works include medical popular-science books such as Cancer Truth: Doctors Are Reading It Too and New Knowledge on Cancer by Bo Luo (Li Zhizhong), legal titles such as Sunshine Is the Best Preservative: Express Delivery of Major Global Anti-Corruption Cases, and works like Qi Ge's A Brief History of Philosophy with Big Ideas and Liu Yunhao's From the Internet to a New Industrial Revolution. Its authors include science writers, medical researchers, the Renmin University of China anti-corruption master's class and university scholars, reflecting a publishing profile that balances academic seriousness with accessible reading. As public information is limited, this profile is based only on the titles in our collection.

Contents

  1. Part 1 Getting to Know Shell Programming
  2. Chapter 1 Shell Basics
  3. 1.1 Why Learn and Use Shell Programming
  4. 1.2 What Is Shell
  5. 1.2.1 The Origins of Shell
  6. 1.2.2 The Functions of Shell
  7. 1.2.3 Types of Shell
  8. 1.3 Shell as a Programming Language
  9. 1.3.1 Interactive Programs
  10. 1.3.2 Creating Scripts
  11. 1.3.3 Making Scripts Executable
  12. 1.4 Passing Arguments to Scripts
  13. 1.5 Your First Shell Program: Hello, Bash Shell!
  14. 1.5.1 Basic Elements of a Shell Script
  15. 1.5.2 Specifying the Command Interpreter
  16. 1.5.3 Comments and Style in Shell Scripts
  17. 1.5.4 How to Execute a Shell Program
  18. 1.5.5 Exit Status of Shell Programs
  19. Chapter 2 Setting Up a Shell Programming Environment
  20. 2.1 Setting Up on Different Operating Systems
  21. 2.2 Choosing an Editor
  22. 2.3 Configuring the System Environment
  23. Part 2 Shell Programming Fundamentals
  24. Chapter 3 Variables and Quoting
  25. Chapter 4 Conditional Tests and Judgment Statements
  26. Chapter 5 Loop Structures
  27. Chapter 6 Functions
  28. Chapter 7 Arrays
  29. Chapter 8 Regular Expressions
  30. Chapter 9 Basic Text Processing
  31. Chapter 10 The Stream Editor
  32. Chapter 11 The awk Tool
  33. Chapter 12 File Operations
  34. Chapter 13 Subshells and Process Handling
  35. Part 3 Shell Programming in Practice
  36. Chapter 14 Shell Script Debugging Techniques
  37. Chapter 15 Comprehensive Case Studies

FAQ

这本书讲的是哪种 Shell?
全书以 Bash Shell 为主线展开讲解,这是绝大多数 Linux 发行版默认的 Shell。书中会介绍 Shell 的分类与差异,但示例和语法体系都围绕 Bash 编写。
零基础能直接读这本吗?
需要具备最基本的 Linux 命令行操作经验,比如会登录系统、会 cd/ls 这类命令。完全没接触过 Linux 的读者,建议先补一本入门书,再回来读这本会更顺。
第 1 版和第 2 版有什么区别?
第 1 版由清华大学出版社于 2014 年出版,ISBN 9787302338079;第 2 版于 2024 年推出,基于较新的 Bash 版本改写,补充了思维导图、教学 PPT、习题答案等配套资源,并修订了原书疏漏。购买时请留意版本与 ISBN。
书里的例子能直接用在工作中吗?
书中示例贴近系统维护场景,很多可以直接改用。但不同发行版的命令选项和路径存在差异,建议在目标环境上先小范围验证,再用于生产脚本。
配套视频和资源怎么获取?
第 1 版随书附带教学视频及 Linux 入门资源,获取方式以书内说明为准;第 2 版可通过清华大学出版社官网图书页面或书中标注的方式下载配套资源。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

About the author

张春晓 Author

Zhang Chunxiao, about whom public information is limited, works across the collation of classical poetry, literary appreciation and contemporary critical theory. Seven of his titles are held in the collection, including editions and interpretations of Shen Zufen's poetry, studies of Tang seven-character quatrains and Song ci, as well as prose and collections of letters and diaries. Representative works such as The River-Crossing Poetry Collection, The Complete Works of Shen Zufen: A Brief Commentary on Tang Seven-Character Quatrains and the two-volume Master Classes on Tang and Song Poetry show his sustained engagement with the textual editing and popular explanation of classical verse. The Voice of the Other: Reflections on the Binary Structure of Postcolonial Theory turns to postcolonial criticism, revealing a range that moves from classical scholarship to theoretical inquiry. Overall, his writing centers on poetry appreciation and literary-historical compilation, combining scholarly organization with guidance for general readers.

More by the same author

Top rated in the same category