xref: /illumos-gate/usr/src/test/util-tests/tests/awk/gnu/compare.sh (revision 698f4ab6008be205f4362675967638572eef4f21)
1#!/bin/bash
2
3if [[ -z "$AWK" ]]; then
4    printf '$AWK must be set\n' >&2
5    exit 1
6fi
7
8$AWK 'BEGIN {
9	if (ARGV[1]) print 1
10	ARGV[1] = ""
11	if (ARGV[2]) print 2
12	ARGV[2] = ""
13	if ("0") print "zero"
14	if ("") print "null"
15	if (0) print 0
16}
17{
18	if ($0) print $0
19	if ($1) print $1
20}' 0 1 compare.in
21