File: test.debug_badlevel

package info (click to toggle)
shellia 5.7.6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 728 kB
  • sloc: sh: 7,087; makefile: 34
file content (31 lines) | stat: -rwxr-xr-x 793 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# vim: set filetype=sh :
#        file: test.debug_badlevel
#   copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2007-2020)
#     license: GNU General Public License, version 3
# description: test error in shell script using dbg
#    see also: example.debug_badlevel

# The following tests are included:
# (1) Run without options

. ./tstlib

shell=""
while [ $# -ne 0 ]; do
  if [ "$1" = "-s" ]; then
    shell="$2"
    shift 2
  else
    echo "ERROR $0: unknown option <$1>" >&2
    exit 1
  fi
done

[ "$shell" ] && set -- "$@" -s "$shell"

cmd=$(dirname $0)/example.debug_badlevel
check "(1) Run without options" "$@" "$cmd" \
"DEBUG before bad message
SCRIPT-ERROR dbg: Bad level=<nonumber> topic=<none> output=<my debug message>
Command exited with non-zero status 2"