added usage()

This commit is contained in:
2026-01-24 09:14:36 +01:00
parent fb803c13f0
commit e9da74e3c8
2 changed files with 32 additions and 2 deletions

View File

@@ -1,12 +1,27 @@
#!/bin/bash #!/bin/bash
usage() {
local name=${0##*/}
cat <<-EOF
Usage: ${name} [-h || --help] <logfile> <outfile> <title>
Generates graph of the <logfile> and writes it to <outfile>
EOF
}
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
usage
exit 0
fi
# Eingabeparameter # Eingabeparameter
LOGFILE="${1}" LOGFILE="${1}"
OUTFILE="${2}" OUTFILE="${2}"
TITLE="${3}" TITLE="${3}"
if [ -z "$LOGFILE" ] || [ -z "$OUTFILE" ] || [ -z "$TITLE" ]; then if [ -z "$LOGFILE" ] || [ -z "$OUTFILE" ] || [ -z "$TITLE" ]; then
echo "Usage: ${0} <temp.log> <output.png> <title>" usage
exit 1 exit 1
fi fi

View File

@@ -5,8 +5,23 @@ ICE_LOG="${2}"
OUTFILE="${3}" OUTFILE="${3}"
TITLE="${4} TITLE="${4}
usage() {
local name=${0##*/}
cat <<-EOF
Usage: ${name} [-h || --help] <logfile>i <logfile2> <outfile> <title>
Generates graph of the <logfile> and <logfile2> and writes it to <outfile>
EOF
}
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
usage
exit 0
fi
if [ -z "${ACTIVE_LOG}" ] || [ -z "${ICE_LOG}" ] || [ -z "${OUTFILE}" ]; then if [ -z "${ACTIVE_LOG}" ] || [ -z "${ICE_LOG}" ] || [ -z "${OUTFILE}" ]; then
echo "Usage: $0 <temp_active.log> <temp_ice.log> <output.png>" usage
exit 1 exit 1
fi fi