Bug 8371 - awk: missing support for length function w/out paren
Summary: awk: missing support for length function w/out paren
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: unspecified
Hardware: PC Other
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL: http://http://pubs.opengroup.org/onli...
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-27 06:41 UTC by Mike Frysinger
Modified: 2015-10-02 00:42 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Frysinger 2015-09-27 06:41:20 UTC
POSIX allows for calling the length function w/out any parentheses:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html

length[([s])]
Return the length, in characters, of its argument taken as a string, or of the whole record, $0, if there is no argument.

simple testcase:
$ echo asdf | gawk '{print length}'
4
$ echo asdf | busybox awk '{print length}'
awk: cmd. line:1: Unexpected token

it does support the implicit $0, but only when () are used:
$ echo asdf | busybox awk '{print length()}'
4
Comment 1 Denys Vlasenko 2015-10-02 00:42:55 UTC
Fixed in git.