欢乐从这里开始(Here is where the fun begins)

来自MagicLinux 百科
Sejishikong讨论 | 贡献2021年12月20日 (一) 20:12的版本 (创建页面,内容为“== <center>快乐从这里开始(Here is where the fun begins)</center> == ===[http://mlwiki.maihaohui.com/index.php/Linux%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%B9%8B%E8%8F%9C%E9%B8%9F%E5%AD%A6%E4%B9%A0%E7%AF%87 返回目录]=== ===[http://www.linuxcommand.org/lts0020.php 原文链接 : http://www.linuxcommand.org/writing_shell_scripts.php]=== With the thousands of commands available for the command line user, how can you remember them all? The answer is, you don't.…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳到导航 跳到搜索

快乐从这里开始(Here is where the fun begins)

返回目录

原文链接 : http://www.linuxcommand.org/writing_shell_scripts.php

With the thousands of commands available for the command line user, how can you remember them all? The answer is, you don't. The real power of the computer is its ability to do the work for you. To get it to do that, we use the power of the shell to automate things. We write scripts.

作为命令行用户,面对数以千计的可使用命令,你怎样才能全部记住他们呢?答案是你不可能做到。电脑的真正作用在于它拥有代你工作的能力。为了实现这一能力,我们可以通过编写shell脚本来实现自动化作业。

Scripts are collections of commands that are stored in a file. The shell can read this file and act on the commands as if they were typed at the keyboard. In addition to the things you have learned so far, the shell also provides a variety of useful programming features to make your scripts truly powerful.

脚本是存储在一个文件中的命令组合。Shell程序可以阅读这一文件并执行所含命令,就像它们是通过键盘逐一输入的一样。迄今为止,除了你所学到的知识,shell还提供多种有效的程序功能使你的脚本作用更加强大。

What are scripts good for? A wide range of tasks can be automated. Here are some of the things I automate with scripts:

脚本擅长做什么呢?可以自动执行大量的任务。以下是我利用脚本自动执行的一些事情:

• A script gathers up all the files (over 2200) in this site on my computer and transmits them to my web server.

• 利用脚本收集本站所有的文件(2200多个),将它们从我的电脑传输到网站服务器上。

• The SuperMan pages are built entirely by a script.

• SuperMan页面(注:作者按字母顺序和功能对Man帮助页进行的索引归类页面)内容均利用一个脚本生成。

• Every Friday night, all my computers copy their files to a "backup server" on my network. This is performed by a script.

• 每周五晚上,我全部的电脑将它们的文件复制到位于我的网络中的一台“备份服务器”上。这一操作也是通过脚本来执行的。

• A script automatically gets the current updates from my Linux vendor and maintains a repository of vital updates. It sends me an email message with a report of tasks that need to be done.

• 一个脚本程序自动从我的Linux厂商那获取当前的升级包并将其保存到重要的升级包仓库中。将需要执行的任务报告以电子邮件形式发送给我。

As you can see, scripts unlock the power of your Linux machine. So let's have some fun!

如你所见,脚本拓展了Linux机器的功能。因此让我们共同寻找其中的乐趣吧。



《 欲知后事如何,且看:编写你的第一个脚本并执行它(Writing your first script and getting it to work ) ]] 》



© 2000-2006, William Shotts, Jr. Verbatim copying and distribution of this entire article is permitted in any medium, provided this copyright notice is preserved.

Linux® is a registered trademark of Linus Torvalds.