您好,登錄后才能下訂單哦!
2016.8.12 23:20-23:50
1.2 SUGGESTED BACKGROUND
1.2 讀者的知識背景
We assume in this book that you have a certain amount of Linux or UNIX experience. In particular, you should have a general concept of how the system looks and feels from the user’s perspective since we don’t review this material. Several good books can get you up to speed; see the reading list on page 27.
本書假定讀者已經具備一定程序的Linux或者UNIX經驗。尤其要從用戶的角度對系統的風格有個一般性的概念,因為我們不再復核這方面的材料。有一些優秀的書籍可以幫助讀者迅速掌握這些概念,請看第27頁。
Even in these days of Compiz-powered 3D desktops, the GUI tools for system administration on UNIX and Linux systems remain fairly simplified in comparison with the richness of the underlying software. In the real world, we still administer by editing configuration files and writing scripts, so you’ll need to be comfortable with both a command-line shell and a text editor.
即便在現今有三維圖形顯示功能的桌面計算機上,用于UNIX和Linux系統管理的GUI工具與其下層豐富的軟件相比,依然顯得相當簡單。在現實世界里,我們仍然要通過編輯配置文件和編寫腳本來完成管理工作,因此讀者需要習慣于使用某種命令行的shell和某種文本編輯器。
Your editor can be a GUI tool like gedit or a command-line tool such as vi or emacs. Word processors such as Microsoft Word and OpenOffice Writer are quite different from text editors and are nearly useless for administrative tasks. Command-line tools have an edge because they can run over simple SSH connections and on ailing systems that won’t boot; there’s no need for a window system. They are also much faster for the quick little edits that administrators often make.
編輯器可以像gedit那樣的GUI工具,也可以是像vi或emacs那樣的命令行工具。像Microsoft Word和OpenOffice這樣的字處理程序和廣本編輯器差別很大,對于系統管理工作幾乎沒有什么用處。命令行工具有個優勢,因為它們可以通過一條SSH連接運行,還可以在出問題不能啟動的系統上使用;而且不需要用圖形窗口系統。對于系統管理員常做的微小編輯工作來說,它們的運行速度也快很多。
We recommend learning vi (now seen most commonly in its rewritten form, vim), which is standard on all UNIX and Linux systems. Although it may appear a bit pallid when compared with glitzier offerings such as emacs, it is powerful and complete. GNU’s nano is a simple and low-impact “starter editor” that has on-screen prompts. Be wary of nonstandard editors, though; if you become addicted to one, you may soon tire of dragging it along with you to install on every new system.
我們推薦讀者學會使用vi(現在最常見的是它的一種經過重寫的形式,即vim)它是所有UNIX和Linux系統上的標準軟件。盡管同emasc這樣的華麗軟件相比,vi可能顯得有些平淡,但vi的功能還是非常強大和完善的。GNU的nano是一種簡單、易上手的“入門編輯器”,它有屏幕提示功能。選用非標準的編輯器則要小心,如果讀者已經對這樣的一種編輯器“上了癮”,那么很快就會對它感到厭煩,因為需要把它帶到身邊,以便在每個新系統上都要安裝一次。
2016.8.13 23:00-23:40
One of the mainstays of administration (and a theme that runs throughout this book) is the use of scripts to automate administrative tasks. To be an effective administrator, you must be able to read and modify Perl and bash/sh scripts.
系統管理工作的主要支柱之一(并且也是貫穿本書的一個主題),是使用腳本來自動完成管理任務。更成為一名高效率的系統管理員,必須能夠閱讀并修改Perl和bash/sh腳本。
For new scripting projects, we recommend Perl or Python. As a programming language, Perl is admittedly a bit strange. However, it does include many features that are indispensable for administrators. The O’Reilly book Programming Perl by Larry Wall et al. is the standard text; it’s also a model of good technical writing. A full citation is given on page 27.
對于編寫新腳本,我們推薦使用Perl或者Python。作為一種編程語言,Perl有些奇怪,不過它確實包含了許多對管理員來說不可少的特性。由O'Reilly出版、Larry Wall等編寫的Programming Perl一書是Perl的標準教程,該書是技術圖書的典范,本書27頁給出了更完整的信息。
Many administrators prefer Python to Perl, and we know of sites that are making a concerted effort to convert. Python is a more elegant language, and Python scripts are generally more readable and easier to maintain. (As Amazon’s Steve Yegge said, “The Python community has long been the refuge for folks who finally took the red pill and woke up from the Perl Matrix.”) A useful set of links that compare Python to other scripting languages (including Perl) can be found at python.org/doc/Comparisons.html.
許多系統管理員更愿意用Python而不是Perl,而且我們也知道有些地方正在一起努力從Perl轉向Python。Python是一種比Perl更優美的語言,而且Python腳本往往可讀性更好,也更容易維護(正如亞馬遜公司的Steve Yegge所說,“長久以來,Python社區都是從Perl陣營逃出來的人的庇護所,這些人吞下紅色的藥丸,從Perl的Matrix里蘇醒過來”)。從python.org/doc/Comparisons.html可以找到一組有用的鏈接,把Ptyhon同其他腳本語言(包含Perl)進行一番比較。
Ruby is an up-and-coming language that maintains many of the strengths of Perl while avoiding some of Perl’s syntactic pitfalls and adding modern object-oriented features. It doesn’t yet have a strong tradition as a scripting language for system administrators, but that will likely change over the next few years.
Ruby是一款正處于上升期的語言,它保留了Perl的許多強大功能,又避免了Peral的一些語法缺陷,還增加了現代的面向對象特性。它作為系統管理員的一款腳本語言,其根基還不深,但在未來幾年內,這種情況可能會有所改變。
We also suggest that you learn expect, which is not a programming language so much as a front end for driving interactive programs. It’s an efficient glue technology that can replace some complex scripting. expect is easy to learn.
我們還推薦讀者學會expect。它與其說是一款編程語言,倒不如說是用于驅動交互式程序執行的前端語言。它是一款高效的“膠水”語言,能夠替代一些復雜的腳本編程,expect腳本學起來很容易。
Chapter 2, Scripting and the Shell, summarizes the most important things to know about scripting for bash, Perl, and Python. It also reviews regular expressions (text matching patterns) and some shell idioms that are useful for sysadmins.
本書的第2章總結了有關bash、Perl和Python腳本編程最重要的知識。這一章還復習了正則表達式(文本匹配模式)和一些shell的慣用法,它們對用系統管理工作來說很有用。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。