compgen, eval, export, file: move to common (#6508)

This commit is contained in:
marchersimon
2021-09-13 15:24:42 +02:00
committed by GitHub
parent efeee14594
commit ac46610ce6
13 changed files with 2 additions and 78 deletions

View File

@@ -1,24 +0,0 @@
# compgen
> 用于在 bash 中自动完成的内置命令,按两次 tab 键即可调用该命令。
> 更多信息:<https://www.cyberciti.biz/open-source/command-line-hacks/compgen-linux-command/>.
- 显示所有可以执行的命令:
`compgen -c`
- 列出所有别名:
`compgen -a`
- 列出所有可以运行的函数:
`compgen -A function`
- 列出所有 shell 的保留关键字:
`compgen -k`
- 查看以 'ls' 开头的所有可用命令和别名:
`compgen -ac {{ls}}`

View File

@@ -1,12 +0,0 @@
# eval
> 在当前 shell 中以单个命令的形式执行参数,并返回其结果。
> 更多信息:<https://ss64.com/osx/eval.html>.
- 使用 'foo' 做为参数调用 `echo`:
`eval "{{echo foo}}"`
- 在当前 shell 程序中设置变量:
`eval "{{foo=bar}}"`

View File

@@ -1,16 +0,0 @@
# export
> 命令为当前 shell 中的子进程进行环境变量设置。
> 更多信息:<https://ss64.com/osx/export.html>.
- 设置为新的环境变量:
`export {{某变量名}}={{值}}`
- 删除环境变量:
`export -n {{某变量名}}`
- 给 PATH 追加新的路径进去:
`export PATH=$PATH:{{追加的 path 路径}}`

View File

@@ -1,23 +0,0 @@
# file
> 确定文件类型。
- 提供指定文件类型的描述,对于没有文件扩展名的文件可以正常工作:
`file {{文件名}}`
- 查看压缩文件并确定其中的文件类型:
`file -z {{xxx.zip}}`
- 允许文件与特殊文件或设备文件一起使用:
`file -s {{文件名}}`
- 不要在第一个文件类型匹配时停止;继续执行直到文件结束:
`file -k {{文件名}}`
- 确定文件的 mime 编码类型:
`file -I {{文件名}}`