外文翻译--高级Bash脚本编程指南一个对脚本编程技术的深入讨论.doc

上传人:夏** 文档编号:563873150 上传时间:2022-12-14 格式:DOC 页数:6 大小:32.50KB
返回 下载 相关 举报
外文翻译--高级Bash脚本编程指南一个对脚本编程技术的深入讨论.doc_第1页
第1页 / 共6页
外文翻译--高级Bash脚本编程指南一个对脚本编程技术的深入讨论.doc_第2页
第2页 / 共6页
外文翻译--高级Bash脚本编程指南一个对脚本编程技术的深入讨论.doc_第3页
第3页 / 共6页
外文翻译--高级Bash脚本编程指南一个对脚本编程技术的深入讨论.doc_第4页
第4页 / 共6页
外文翻译--高级Bash脚本编程指南一个对脚本编程技术的深入讨论.doc_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《外文翻译--高级Bash脚本编程指南一个对脚本编程技术的深入讨论.doc》由会员分享,可在线阅读,更多相关《外文翻译--高级Bash脚本编程指南一个对脚本编程技术的深入讨论.doc(6页珍藏版)》请在金锄头文库上搜索。

1、 附 录外文资料翻译原文部分Advanced Bash-Scripting GuideAn in-depth exploration of the art of shell scripting 1. IntroductionThe shell is a command interpreter. More than just the insulating layer between the operating system kernel and the user, its also a fairly powerful programming language. A shell program,

2、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 co

3、mmands, 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 languag

4、e.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 i

5、n /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

6、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 deb

7、ugging even the longer ones is straightforward.A shell script is a quick and dirty method of prototyping a complex application. Getting even a limited subset of the functionality to work in a shell script is often a useful first stage in project development. This way, the structure of the applicatio

8、n can be tested and played with, and the major pitfalls found before proceeding to the final coding in C, C+, Java, or Perl.Shell scripting hearkens back to the classic UNIX philosophy of breaking complex projects into simpler subtasks, of chaining together components and utilities. Many consider th

9、is a better, or at least more esthetically pleasing approach to problem solving than using one of the new generation of high powered all-in-one languages, such as Perl, which attempt to be all things to all people, but at the cost of forcing you to alter your thinking processes to fit the tool.When

10、not to use shell scripts Resource-intensive tasks, especially where speed is a factor (sorting, hashing, etc.)Procedures involving heavy-duty math operations, especially floating point arithmetic, arbitrary precision calculations, or complex numbers (use C+ or FORTRAN instead)Cross-platform portabil

11、ity required (use C or Java instead)Complex applications, where structured programming is a necessity (need type-checking of variables, function prototypes, etc.)Mission-critical applications upon which you are betting the ranch, or the future of the companySituations where security is important, wh

12、ere you need to guarantee the integrity of your system and protect against intrusion, cracking, and vandalismProject consists of subcomponents with interlocking dependenciesExtensive file operations required (Bash is limited to serial file access, and that only in a particularly clumsy and inefficie

13、nt line-by-line fashion)Need native support for multi-dimensional arraysNeed data structures, such as linked lists or treesNeed to generate or manipulate graphics or GUIsNeed direct access to system hardwareNeed port or socket I/ONeed to use libraries or interface with legacy codeProprietary, closed

14、-source applications (shell scripts put the source code right out in the open for all the world to see)If any of the above applies, consider a more powerful scripting language - perhaps Perl, Tcl, Python, Ruby - or possibly a high-level compiled language such as C, C+, or Java. Even then, prototypin

15、g the application as a shell script might still be a useful development step.We will be using Bash, an acronym for Bourne-Again shell and a pun on Stephen Bournes now classic Bourne shell. Bash has become a de facto standard for shell scripting on all flavors of UNIX. Most of the principles this boo

16、k covers apply equally well to scripting with other shells, such as the Korn Shell, from which Bash derives some of its features, and the C Shell and its variants. (Note that C Shell programming is not recommended due to certain inherent problems, as pointed out in an October, 1993 Usenet post by Tom Christiansen.) What follows is a tutorial on shell scripting. It relies heavily on examples to illustrate various features o

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 资格认证/考试 > 自考

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号