郑重声明,这个文章不是我写的,是我的同事——刘彬做的学习笔记.我觉得写的太好了,但他又没有发到网上,只好自己贴一下了.转载带上原作者的名字,以及本段声明.
Bash Use And Programming
Contents
- 1 Bash 使用
- 1.1 按键绑定
- 1.2 历史记录
- 1.3 高亮
- 1.4 Bash Completion
- 2 Bash 编程
- 2.1 第一行
- 2.2 Reserved Words (保留字)
- 2.3 Parameters (参数)
- 2.3.1 Positional Parameters (位置参数)
- 2.3.2 Special Parameters (特殊参数)
- 2.4 Branches And Loops (分支与循环)
- 2.4.1 Branches
- 2.4.2 Loops
- 2.5 Expansion (扩展)
- 2.5.1 Brace Expansion (大括号扩展)
- 2.5.2 Tilde Expansion
- 2.5.3 Parameter Expansion (参数扩展)
- 2.5.4 Command Substitution (命令替换)
- 2.5.5 Arithmetic Expansion (数学扩展)
- 2.5.6 Process Substitution (进程替换)
拥有帝国一切,皆有可能。欢迎访问phome.net- 2.5.7 Word Splitting (单词分割)
- 2.5.8 Pathname Expansion (路径扩展)
- 2.5.9 Quote Removal (引号去除)
- 2.6 Tips
- 2.6.1 空字符串测试
- 2.6.2 大小写转换
- 2.6.3 随机数
- 2.6.4 read
- 2.6.5 $cmd 与 eval $cmd
- 2.6.6 local是个内建命令
- 2.6.7 赋值语句后跟命令
- 2.6.8 将结果打到标准输出和错误输出
- 2.6.9 子shell
- 2.6.10 :(){ :|: & };:
- 2.6.11 调试
此文分享我在bash学习,使用,编程中的碰到的一些问题,以及一些体会.
1 Bash 使用
1.1 按键绑定
CTRL 键相关的快捷键:
- Ctrl a - Jump to the start of the line
- Ctrl b - Move back a char
- Ctrl c - Terminate the command
- Ctrl d - Delete from under the cursor
- Ctrl e - Jump to the end of the line
- Ctrl f - Move forward a char
- Ctrl k - Delete to EOL
拥有帝国一切,皆有可能。欢迎访问phome.net- Ctrl l - Clear the screen
- Ctrl r - Search the history backwards
- Ctrl R - Search the history backwards with multi occurrence
- Ctrl u - Delete backward from cursor // 密码输入错误的时候比较有用
- Ctrl xx - Move between EOL and current cursor position
- Ctrl x @ - Show possible hostname completions
- Ctrl z - Suspend/ Stop the command
- Ctrl h - backward-delete-char
- Ctrl w - unix-word-rubout
- Ctrl p - previous-history
- Ctrl n - next-history
ALT 键相关的快捷键:
- Alt < - Move to the first line in the history
- Alt > - Move to the last line in the history
- Alt ? - Show current completion list
- Alt * - Insert all possible completions
- Alt / - Attempt to complete filename
- Alt . - Yank last argument to previous command
- Al
|