Anvil / bash-doxygen

A doxygen filter for bash scripts
Do What The F*ck You Want To Public License
92 stars 24 forks source link

Question about bash function return values #20

Open dxdxdt opened 2 years ago

dxdxdt commented 2 years ago

I think that there are two types of return values of shell functions: the exit code and the standard output. The exit code of a function can be checked for errors and the standard output is usually used as values(call by ref).

if number_of_procs=$(nproc); then
# do something with number_of_procs
else
# handle error
fi

Now, let's say nproc is a shell function rather than the binary. How would you document \retval(the standard output - number of threads) and \exitcode(0 on success, 1 on error)?