同步阅读进度,多语言翻译,过滤屏幕蓝光,评论分享,更多完整功能,更好读书体验,试试 阅读 ‧ 电子书库
Examples
The bash archive also includes an examples directory. This directory contains some subdirectories for scripts, functions, and examples of startup files.
The startup files in the startup-files directory provide many examples of what you can put in your own startup files. In particular, bash_aliases gives many useful aliases. Bear in mind that if you copy these files wholesale, you'll have to edit them for your system because many of the paths will be different. Refer to Chapter 3 for further information on changing these files to suit your needs.
The functions directory contains about 50 files with function definitions that you might find useful. Among them are:
basename
The basename utility, missing from some systemsdirfuncs
Directory manipulation facilitiesdirname
whatis
An implementation of the Tenth Edition Bourne shell whatis builtinwhence
An almost exact clone of the Korn shell whence builtinEspecially helpful, if you come from a Korn shell background, is kshenv. This contains function definitions for some common Korn facilities such as whence, print, and the two-parameter cd builtins.
The scripts directory contains over 20 examples of bash scripts. The two largest scripts are examples of the complex things you can do with shell scripts. The first is a (rather amusing) adventure game interpreter and the second is a C shell interpreter. The other scripts include examples of precedence rules, a scrolling text display, a "spinning wheel" progress display, and how to prompt the user for a particular type of answer.
Not only are the script and function examples useful for including in your environment, they also provide many alternative examples that you can learn from when reading this book. We encourage you to experiment with them.
[2] This configuration information pertains to bash version 3.0 and later. The configuration and installation for earlier versions is fairly easy, although it differs in certain details. For further information, refer to the INSTALL instructions that came with your version of bash.
请支持我们,让我们可以支付服务器费用。
使用微信支付打赏