self-document.sh

来自「BASH Shell 编程 经典教程 《高级SHELL脚本编程》中文版」· Shell 代码 · 共 35 行

SH
35
字号
#!/bin/bash# self-document.sh: 自文档化(self-documenting)的脚本# 修改于"colm.sh".DOC_REQUEST=70if [ "$1" = "-h"  -o "$1" = "--help" ]     # 请求帮助. then  echo; echo "Usage: $0 [directory-name]"; echo  sed --silent -e '/DOCUMENTATIONXX$/,/^DOCUMENTATIONXX$/p' "$0" |  sed -e '/DOCUMENTATIONXX$/d'; exit $DOC_REQUEST; fi: <<DOCUMENTATIONXXList the statistics of a specified directory in tabular format.---------------------------------------------------------------The command line parameter gives the directory to be listed.If no directory specified or directory specified cannot be read,then list the current working directory.DOCUMENTATIONXXif [ -z "$1" -o ! -r "$1" ]then  directory=.else  directory="$1"fi  echo "Listing of "$directory":"; echo(printf "PERMISSIONS LINKS OWNER GROUP SIZE MONTH DAY HH:MM PROG-NAME\n" \; ls -l "$directory" | sed 1d) | column -texit 0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?