xref: /illumos-gate/usr/src/test/util-tests/tests/awk/gnu/leaddig.sh (revision e6d6c189fa3a95d7aa27bbe0aeacf7c1a6b57c8c)
1*e6d6c189SCody Peter Mello#!/bin/bash
2*e6d6c189SCody Peter Mello
3*e6d6c189SCody Peter Melloif [[ -z "$AWK" ]]; then
4*e6d6c189SCody Peter Mello    printf '$AWK must be set\n' >&2
5*e6d6c189SCody Peter Mello    exit 1
6*e6d6c189SCody Peter Mellofi
7*e6d6c189SCody Peter Mello
8*e6d6c189SCody Peter Mello# check that values with leading digits get converted the
9*e6d6c189SCody Peter Mello# right way, based on a note in comp.lang.awk.
10*e6d6c189SCody Peter Mello#
11*e6d6c189SCody Peter Mello# run with gawk -v x=2E -f leaddig.awk
12*e6d6c189SCody Peter Mello$AWK -v x=2E 'BEGIN {
13*e6d6c189SCody Peter Mello	print "x =", x, (x == 2), (x == 2E0), (x == 2E), (x == 2D)
14*e6d6c189SCody Peter Mello}'
15