BASH:修订间差异
创建页面,内容为“__NOTOC__ == GNU [http://www.gnu.org/software/bash/ Bash] == Bash is the GNU Project's shell. Bash is the Bourne Again SHell. Bash is an sh-compatible shell that inc…” |
|||
| 第30行: | 第30行: | ||
| 示例 || 示例 || 示例 | | 示例 || 示例 || 示例 | ||
|} | |} | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| 第38行: | 第39行: | ||
| 示例 || 示例 || 示例 | | 示例 || 示例 || 示例 | ||
|} | |} | ||
== 脚本 == | |||
=== 批量下载 === | |||
下载文本。 | |||
{{hc|head=urls.txt|output=<syntaxhighlight lang="bash"> | |||
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 | |||
</syntaxhighlight>}} | |||
脚本内容。 | |||
<syntaxhighlight lang="javascript"> | |||
#!/bin/bash | |||
while read file_name file_url | |||
do | |||
wget -O ${file_name} -c ${file_url} | |||
done < urls.txt</syntaxhighlight> | |||
== 书籍 == | == 书籍 == | ||
2022年7月29日 (五) 08:54的版本
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
书籍
| Advanced Bash-Scripting Guide | 示例 | 示例 |
| 示例 | 示例 | 示例 |
| 示例 | 示例 | 示例 |
No categories