BASH
GNU Bash
Bash is the GNU Project's shell. Bash is the Bourne Again SHell. Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). It is intended to conform to the IEEE POSIX P1003.2/ISO 9945.2 Shell and Tools standard. It offers functional improvements over sh for both programming and interactive use. In addition, most sh scripts can be run by Bash without modification.
The improvements offered by Bash include:
- Command line editing
- Unlimited size command history
- Job Control
- Shell Functions and Aliases
- Indexed arrays of unlimited size
- Integer arithmetic in any base from two to sixty-four
The maintainer also has a bash page which includes Frequently-Asked-Questions.
Downloading Bash
Bash can be found on the main GNU ftp server: http://ftp.gnu.org/gnu/bash/ (via HTTP) and ftp://ftp.gnu.org/gnu/bash/ (via FTP). It can also be found on the GNU mirrors; please use a mirror if possible.
Documentation
Documentation for Bash is available online, as is documentation for most GNU software. You may also find more information about Bash by running info bash or man bash, or by looking at /usr/doc/bash/, /usr/local/doc/bash/, or similar directories on your system. A brief summary is available by running bash --help.
实例
| Shell读取文件 | Shell合并文件 | 获取服务器运行时间列表 |
| 示例 | 示例 | 示例 |
| Read | while | For |
| 调试 | 示例 | 示例 |
| 示例 | 示例 | 示例 |
脚本
批量下载
下载文本。
https://github.com/asciinema/asciinema-player/releases/download/v3.0.1/asciinema-player.css
https://github.com/asciinema/asciinema-player/releases/download/v3.0.1/asciinema-player.min.js
脚本内容。
#!/bin/bash
while read file_name file_url
do
wget -O ${file_name} -c ${file_url}
done < urls.txt
命令
| 标题文字 | 标题文字 | 标题文字 |
|---|---|---|
| $$ | 脚本本身的进程 ID (PID) | /home/kangkk echo $$
# 27326
|
| 示例 | 示例 | 示例 |
| 示例 | 示例 | 示例 |
书籍
| Advanced Bash-Scripting Guide | 示例 | 示例 |
| 示例 | 示例 | 示例 |
| 示例 | 示例 | 示例 |
No categories