Bash 如何记录shell函数?
我正在寻找一些格式来描述shell脚本中的函数。 例如,在PHP中:Bash 如何记录shell函数?,bash,function,shell,documentation,Bash,Function,Shell,Documentation,我正在寻找一些格式来描述shell脚本中的函数。 例如,在PHP中: /** * My description * * @param string $paramOne Some extra comment for this parameter * @param int $paramTwo * @return $this */ function myCoolFunc($paramOne, $paramTwo) { } 有文档格式吗 UPD 1我不是在找文档处理程序。只是格式 是
/**
* My description
*
* @param string $paramOne Some extra comment for this parameter
* @param int $paramTwo
* @return $this
*/
function myCoolFunc($paramOne, $paramTwo)
{
}
有文档格式吗
UPD 1我不是在找文档处理程序。只是格式
是这样的:
# Simple yes/no dialog question
#
# e.g.: $(dialog_yes_no 'Would like to repeat?' 'n' 3)
#
# string question
# string default
# int mistakes_count = 5
function dialog_yes_no
{
}
我确实使用以下格式,您可以开始使用这种格式,它类似于unix/linux使用的man/info
#!/bin/ksh
#================================================================
# HEADER
#================================================================
#% SYNOPSIS
#+ ${SCRIPT_NAME} [-hv] [-o[file]] args ...
#%
#% DESCRIPTION
#% This is a script template
#% to start any good shell script.
#%
#% OPTIONS
#% -o [file], --output=[file] Set log file (default=/dev/null)
#% use DEFAULT keyword to autoname file
#% The default value is /dev/null.
#% -t, --timelog Add timestamp to log ("+%y/%m/%d@%H:%M:%S")
#% -x, --ignorelock Ignore if lock file exists
#% -h, --help Print this help
#% -v, --version Print script information
#%
#% EXAMPLES
#% ${SCRIPT_NAME} -o DEFAULT arg1 arg2
#%
#================================================================
#- IMPLEMENTATION
#- version ${SCRIPT_NAME} (www.uxora.com) 0.0.4
#- author Michel VONGVILAY
#- copyright Copyright (c) http://www.uxora.com
#- license GNU General Public License
#- script_id 12345
#-
#================================================================
# HISTORY
# 2015/03/01 : mvongvilay : Script creation
# 2015/04/01 : mvongvilay : Add long options and improvements
#
#================================================================
# DEBUG OPTION
# set -n # Uncomment to check your syntax, without execution.
# set -x # Uncomment to debug this shell script
#
#================================================================
# END_OF_HEADER
#================================================================
您打算使用什么来实际生成输出文档?php使用什么?这不是bash的问题,而是您正在使用的IDE或文档处理器的问题,如果这是您最终要看的。如果格式只是供您阅读,那么使用您想要的任何内容。如果是为了工具,那么你需要使用工具能够理解的东西。如果问题是针对你的,那么我看不出你希望任何人如何回答。如果评论只是供你自己阅读,你为什么要求一种特殊的格式?使用任何适合你的东西!只有当某些解析器/编译器必须处理这些注释时,这种格式才令人感兴趣。@criswell,是的,谷歌shell编码标准对我很有用。我想你可以在链接中发布一个答案:这并不能真正回答如何记录函数的问题(无论如何也没有一个真实的答案)。这是一个很好看的脚本头模板。@chepner,但这里没有其他选项可供选择:P@Kirby你不需要接受任何答案。