self-document.sh

来自「一本完整的描述Unix Shell 编程的工具书的所有范例」· Shell 代码 · 共 35 行

SH
35
字号
#!/bin/bash# self-document.sh: self-documenting script# Modification of "colm.sh".DOC_REQUEST=70if [ "$1" = "-h"  -o "$1" = "--help" ]     # Request 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 + -
显示快捷键?