.config/nvim/plugged
bash-support.vim
bash-support.vim
README
autoload
mmtemplates
bash-support
README.bashsupport
codesnippets
_trap_DEBUG_trap_ERR_trap_EXIT_trap_RETURNbasename+pathnamecheck-for-signed-integercheck-for-unsigned-integercheck-number-of-command-line-argumentscreate-tempfilecreate-tempfile-in-secure-mannercreate-tempfile-with-trap
debugging
free-software-commenttimestampusage-and-command-line-arguments.noindentuse-file-descriptor-readuse-file-descriptor-writewell-behaved-scriptrc
scripts
templates
Templatesbuiltins.templatescomments.templatesenvironment.templatesio-redirection.templatesparamsub.templatespatternmatching.templatesregexp.templatesset.templatesshelloptions.templatesspecialparams.templatesstatements.templatestests.templates
wordlists
doc
ftplugin
plugin
syntax
@ -0,0 +1,22 @@
|
||||
# PS4 : timestamp; the current time in 24-hour HH:MM:SS format
|
||||
PS4='+[\t] '
|
||||
|
||||
# PS4 : timestamp; 'seconds.nanoseconds' since 1970-01-01 00:00:00 UT
|
||||
PS4='+[$(date "+%s.%N")] '
|
||||
|
||||
# PS4 : position, line number, function name
|
||||
# The following line avoids error messages due to an unset FUNCNAME[0] :
|
||||
# set +o nounset # Treat unset variables as an error
|
||||
#
|
||||
PS4='+|${BASH_SOURCE##*/} ${LINENO}${FUNCNAME[0]:+ ${FUNCNAME[0]}}| '
|
||||
|
||||
# PS4 : position, line number, function name, subshell information
|
||||
# The following line avoids error messages due to an unset FUNCNAME[0] :
|
||||
# set +o nounset # Treat unset variables as an error
|
||||
#
|
||||
PS4='+(${BASH_SOURCE##*/}: ${LINENO}) : ${FUNCNAME[0]} - [level ${SHLVL}, '
|
||||
PS4=$PS4'subshell ${BASH_SUBSHELL}, return code $?]\n '
|
||||
|
||||
# PS4 : default prompt
|
||||
PS4='+ '
|
||||
|
16
.config/nvim/plugged/bash-support.vim/bash-support/codesnippets/debugging/_debug_assert
Normal file
16
.config/nvim/plugged/bash-support.vim/bash-support/codesnippets/debugging/_debug_assert
Normal file
@ -0,0 +1,16 @@
|
||||
#=== FUNCTION ================================================================
|
||||
# NAME: _assert
|
||||
# DESCRIPTION: Abort the script if assertion is false.
|
||||
# PARAMETERS: 1) expression used as test inside brackets
|
||||
# 2) optional information, e.g. $LINENO
|
||||
# RETURNS: 0 / 99 assertion is true / false
|
||||
#===============================================================================
|
||||
function _assert ()
|
||||
{
|
||||
if [ ! $1 ]; then
|
||||
echo "${0##*/}${2:+:$2}: assertion '$1' failed."
|
||||
exit 99
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
15
.config/nvim/plugged/bash-support.vim/bash-support/codesnippets/debugging/_debug_function.noindent
Normal file
15
.config/nvim/plugged/bash-support.vim/bash-support/codesnippets/debugging/_debug_function.noindent
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
DEBUG=${DEBUG:-0} # 0 = no debug output, 1 = show debug output,
|
||||
# or enable debug with: DEBUG=1 script.sh
|
||||
|
||||
#=== FUNCTION ================================================================
|
||||
# NAME: _debug
|
||||
# DESCRIPTION: echo debug output controlled by a global variable
|
||||
# PARAMETERS: list, e.g.; "$LINENO: x=$x"
|
||||
# RETURNS: always 0
|
||||
#===============================================================================
|
||||
_debug ()
|
||||
{
|
||||
[ ${DEBUG} -ne 0 ] && echo -e "${@}"
|
||||
return 0
|
||||
} # ---------- end of function _debug ----------
|
3
.config/nvim/plugged/bash-support.vim/bash-support/codesnippets/debugging/_debug_print_pos_param
Normal file
3
.config/nvim/plugged/bash-support.vim/bash-support/codesnippets/debugging/_debug_print_pos_param
Normal file
@ -0,0 +1,3 @@
|
||||
# print the positional parameters
|
||||
printf "'%b'\n" "$0" "$@" | nl -v0 -s': '
|
||||
|
16
.config/nvim/plugged/bash-support.vim/bash-support/codesnippets/debugging/_debug_timestamp.noindent
Normal file
16
.config/nvim/plugged/bash-support.vim/bash-support/codesnippets/debugging/_debug_timestamp.noindent
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
DEBUG=${DEBUG:-0} # 0 = no debug output, 1 = show debug output,
|
||||
# or enable debug with: DEBUG=1 script.sh
|
||||
|
||||
#=== FUNCTION ================================================================
|
||||
# NAME: _debug_timestamp
|
||||
# DESCRIPTION: timestamp + optional information
|
||||
# timestamp: {seconds since 1970-01-01 00:00:00}.{nanoseconds}
|
||||
# PARAMETERS: identification, e.g. $LINENO (optional)
|
||||
# RETURNS: always 0
|
||||
#===============================================================================
|
||||
_debug_timestamp ()
|
||||
{
|
||||
[ ${DEBUG} -ne 0 ] && echo -e "[ $(date "+%s.%N") ]${@:+ -- ${@}}"
|
||||
return 0
|
||||
} # ---------- end of function _debug_timestamp ----------
|
Reference in New Issue
Block a user