aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib/external_command_scripts/output.sh
blob: 0472c89a3f41cbbee94066f0de87a4b639a2e0b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

out_msg=${1:-out}
err_msg=${2:-}
repeats=${3:-10}
exit_status=${4:-0}

n=0
while [ "$n" -lt "$repeats" ]
do
  if [ -n "$out_msg" ]
  then
    echo "$out_msg $n"
  fi
  if [ -n "$err_msg" ]
  then
    echo >&2 "$err_msg $n"
  fi
  n=$[$n + 1]
done

exit "$exit_status"