Skip to content

Commit fe85d86

Browse files
committed
improve docs
1 parent bd4ed88 commit fe85d86

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

docs/shell.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@
2828
- [示例](#%E7%A4%BA%E4%BE%8B-5)
2929
- [使用方式](#%E4%BD%BF%E7%94%A8%E6%96%B9%E5%BC%8F)
3030
- [🍺 console-text-color-themes.sh](#-console-text-color-themessh)
31+
- [用法](#%E7%94%A8%E6%B3%95-2)
32+
- [示例](#%E7%A4%BA%E4%BE%8B-6)
33+
- [运行效果](#%E8%BF%90%E8%A1%8C%E6%95%88%E6%9E%9C)
3134
- [贡献者](#%E8%B4%A1%E7%8C%AE%E8%80%85-2)
3235
- [参考资料](#%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99-1)
3336
- [🍺 parseOpts.sh](#-parseoptssh)
34-
- [用法](#%E7%94%A8%E6%B3%95-2)
35-
- [示例](#%E7%A4%BA%E4%BE%8B-6)
37+
- [用法](#%E7%94%A8%E6%B3%95-3)
38+
- [示例](#%E7%A4%BA%E4%BE%8B-7)
3639
- [兼容性](#%E5%85%BC%E5%AE%B9%E6%80%A7)
3740
- [贡献者](#%E8%B4%A1%E7%8C%AE%E8%80%85-3)
3841

@@ -56,27 +59,35 @@
5659
有3种使用风格,根据需要或是你的偏好选取。
5760

5861
```bash
62+
############################################################
5963
# 1. 前缀方式,后面跟上要运行的命令
64+
############################################################
6065
$ c pwd
6166
/Users/jerry
6267
$ c echo -e 'a\nb'
6368
a
6469
b
6570
# 这种使用方式,后面跟的命令不能是别名(alias),对于别名可以用下面的使用方式。
6671

72+
############################################################
6773
# 2. 后缀方式,管道
74+
############################################################
6875
$ echo -e 'a\nb' | nl | c
6976
1 a
7077
2 b
7178
# gb是oh-my-zsh的别名,列出git的分支,需要后缀的方式的使用。
7279
$ gb | c
7380

81+
############################################################
7482
# 3. 从标准输入读取内容。拷贝文件内容时这种方式最直接。
83+
############################################################
7584
$ c < ~/.ssh/id_rsa.pub
7685
ssh-rsa EAAAABIwAAAQEAz+ETZEgoLeIiC0rjWewdDs0sbo8c...== [email protected]
7786

87+
############################################################
7888
# -q选项:拷贝但不输出。
7989
# 当输出内容比较多、又不关心输出内容和命令执行进展时,可以使用这个选项。
90+
############################################################
8091
$ c -q < ~/.ssh/id_rsa.pub
8192

8293
# 帮助信息
@@ -337,21 +348,28 @@ $ ./echo-args 1 " 2 foo " "3 3"
337348
显示`Terminator`的全部文字彩色组合的效果及其打印方式。
338349
支持`Linux``Mac``Windows``cygwin``MSSYS`)。
339350
340-
脚本中,也给出了`colorEcho``colorEchoWithoutNewLine`函数更方便输出彩色文本,用法:
351+
脚本中,也给出了`colorEcho``colorEchoWithoutNewLine`函数更方便输出彩色文本
352+
353+
### 用法
341354
342355
```bash
343356
colorEcho <颜色样式> <要输出的文本>...
344357
colorEchoWithoutNewLine <颜色样式> <要输出的文本>...
345358
```
346359
360+
### 示例
361+
347362
```bash
363+
source console-text-color-themes.sh
364+
348365
# 输出红色文本
349366
colorEcho "0;31;40" "Hello world!"
350367
# 输出黄色带下划线的文本
351368
colorEchoWithoutNewLine "4;33;40" "Hello world!" "Hello Hell!"
352369
```
353370
354-
`console-text-color-themes.sh`的运行效果图如下:
371+
### 运行效果
372+
355373
![console-text-color-themes.sh的运行效果图](console-colorful-text.png)
356374
357375
### 贡献者

0 commit comments

Comments
 (0)