xref: /illumos-gate/usr/src/test/util-tests/tests/awk/gnu/compare.sh (revision d48be21240dfd051b689384ce2b23479d757f2d8)
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