高级bash脚本编程指南(外文文献翻译).doc
约25页DOC格式手机打开展开
高级bash脚本编程指南(外文文献翻译),高级bash脚本编程指南一个对脚本编程技术的深入讨论1:简介shell是一个命令解释器。它是操作系统内核和用户之间的绝缘层,也是一种功能强大的编程语言。一个shell程序,通常被称作为脚本,它是由系统调用,命令工具,软件包和已编译的二进制包"结合" 起来的容易使用的工具。事实上,shell脚本可以调用整个unix系统命...
内容介绍
此文档由会员 wanli1988go 发布
高级Bash脚本编程指南
一个对脚本编程技术的深入讨论
1:简介
Shell是一个命令解释器。它是操作系统内核和用户之间的绝缘层,也是一种功能强大的编程语言。一个Shell程序,通常被称作为脚本,它是由系统调用,命令工具,软件包和已编译的二进制包"结合" 起来的容易使用的工具。事实上,shell脚本可以调用整个UNIX系统命令,软件包和工具。如果这还不太够的话,Shell的内部命令,如测试和循环结构,都使得Shell脚本更强大和更有弹性。Shell脚本在管理系统任务中表现得非常出色,在对日常反复性的处理工作中避免使用那些结构复杂的程序语言。
2:为什么要用Shell编程?
脚本应用知识对希望精通系统管理的任何个人说是必需的,他实际上不想写一个脚本程序。一般说一个Linux机器启动后,它会执行在/etc/rc.d 目录下的Shell脚本重建系统环境并且启动各种服务。理解这些启动脚本的细节对分析系统运作并修改它是有很大意义的。
编写shell脚本并不难学,因为脚本内建的功能集(check?)和他们只要学相当少的shell的操作符和选项。语法简单易懂,像在命令行上调用和连接软件包那样容易,它只有少量的 "规则" 需要掌握。大多数短小的脚本第一次就工作的很好,较长的脚本调试也相当的容易。
shell脚本是个复杂应用原型的"quick and dirty" 方法。在项目开发中用shell编程实现个有限的功能性子集是有用的开始。用这种方法去测试应用程序的结构和模块组合,可以在实际地用C,C++,Java或者Perl进行编程之前发现主要的设计缺陷。
Advanced Bash-Scripting Guide
An in-depth exploration of the art of shell scripting
1. Introduction
The shell is a command interpreter. More than just the insulating layer between the operating system kernel and the user, it's also a fairly powerful programming language. A shell program, called a script, is an easy-to-use tool for building applications by "gluing" together system calls, tools, utilities, and compiled binaries. Virtually the entire repertoire of UNIX commands, utilities, and tools is available for invocation by a shell script. If that were not enough, internal shell commands, such as testing and loop constructs, give additional power and flexibility to scripts. Shell scripts lend themselves exceptionally well to administrative system tasks and other routine repetitive jobs not requiring the bells and whistles of a full-blown tightly structured programming language.
2. Why Shell Programming?
A working knowledge of shell scripting is essential to anyone wishing to become reasonably proficient at system administration, even if they do not anticipate ever having to actually write a script. Consider that as a Linux machine boots up, it executes the shell scripts in /etc/rc.d to restore the system configuration and set up services. A detailed understanding of these startup scripts is important for analyzing the behavior of a system, and possibly modifying it.
Writing shell scripts is not hard to learn, since the scripts can be built in bite-sized sections and there is only a fairly small set of shell-specific operators and options to learn. The syntax is simple and straightforward, similar to that of invoking and chaining together utilities at the command line, and there are only a few "rules" to learn. Most short scripts work right the first time, and debugging even the longer ones is straightforward.
一个对脚本编程技术的深入讨论
1:简介
Shell是一个命令解释器。它是操作系统内核和用户之间的绝缘层,也是一种功能强大的编程语言。一个Shell程序,通常被称作为脚本,它是由系统调用,命令工具,软件包和已编译的二进制包"结合" 起来的容易使用的工具。事实上,shell脚本可以调用整个UNIX系统命令,软件包和工具。如果这还不太够的话,Shell的内部命令,如测试和循环结构,都使得Shell脚本更强大和更有弹性。Shell脚本在管理系统任务中表现得非常出色,在对日常反复性的处理工作中避免使用那些结构复杂的程序语言。
2:为什么要用Shell编程?
脚本应用知识对希望精通系统管理的任何个人说是必需的,他实际上不想写一个脚本程序。一般说一个Linux机器启动后,它会执行在/etc/rc.d 目录下的Shell脚本重建系统环境并且启动各种服务。理解这些启动脚本的细节对分析系统运作并修改它是有很大意义的。
编写shell脚本并不难学,因为脚本内建的功能集(check?)和他们只要学相当少的shell的操作符和选项。语法简单易懂,像在命令行上调用和连接软件包那样容易,它只有少量的 "规则" 需要掌握。大多数短小的脚本第一次就工作的很好,较长的脚本调试也相当的容易。
shell脚本是个复杂应用原型的"quick and dirty" 方法。在项目开发中用shell编程实现个有限的功能性子集是有用的开始。用这种方法去测试应用程序的结构和模块组合,可以在实际地用C,C++,Java或者Perl进行编程之前发现主要的设计缺陷。
Advanced Bash-Scripting Guide
An in-depth exploration of the art of shell scripting
1. Introduction
The shell is a command interpreter. More than just the insulating layer between the operating system kernel and the user, it's also a fairly powerful programming language. A shell program, called a script, is an easy-to-use tool for building applications by "gluing" together system calls, tools, utilities, and compiled binaries. Virtually the entire repertoire of UNIX commands, utilities, and tools is available for invocation by a shell script. If that were not enough, internal shell commands, such as testing and loop constructs, give additional power and flexibility to scripts. Shell scripts lend themselves exceptionally well to administrative system tasks and other routine repetitive jobs not requiring the bells and whistles of a full-blown tightly structured programming language.
2. Why Shell Programming?
A working knowledge of shell scripting is essential to anyone wishing to become reasonably proficient at system administration, even if they do not anticipate ever having to actually write a script. Consider that as a Linux machine boots up, it executes the shell scripts in /etc/rc.d to restore the system configuration and set up services. A detailed understanding of these startup scripts is important for analyzing the behavior of a system, and possibly modifying it.
Writing shell scripts is not hard to learn, since the scripts can be built in bite-sized sections and there is only a fairly small set of shell-specific operators and options to learn. The syntax is simple and straightforward, similar to that of invoking and chaining together utilities at the command line, and there are only a few "rules" to learn. Most short scripts work right the first time, and debugging even the longer ones is straightforward.