99 lines · 1.8 KB · Text
RawDownload
#!/bin/rcecho T.getline: test getline function >[1=2] who >foo1cat foo1 | $awk 'BEGIN {	while (getline)		print	exit}' >foocmp -s foo1 foo || echo 'BAD: T.getline: bare getline' >[1=2] who >foo1cat foo1 | $awk 'BEGIN {	while (getline xxx)		print xxx	exit}' >foocmp -s foo1 foo || echo 'BAD: T.getline: getline xxx' >[1=2] sed 1000q /lib/ucd/UnicodeData.txt >foo.txt $awk 'BEGIN {	while (getline <"foo.txt")		print	exit}' >foocmp -s foo.txt foo || echo 'BAD: T.getline: getline <file' >[1=2] cat foo.txt | $awk 'BEGIN {	while (getline <"-")	# stdin		print	exit}' >foocmp -s foo.txt foo || echo 'BAD: T.getline: getline <"-"' >[1=2] $awk 'BEGIN {	while (getline <ARGV[1])		print	exit}' foo.txt >foocmp -s foo.txt foo || echo 'BAD: T.getline: getline <arg' >[1=2] $awk 'BEGIN {	while (getline x <ARGV[1])		print x	exit}' foo.txt >foocmp -s foo.txt foo || echo 'BAD: T.getline: getline x <arg' >[1=2] $awk 'BEGIN {	while (("cat " ARGV[1]) | getline)		print	exit}' foo.txt >foocmp -s foo.txt foo || echo 'BAD: T.getline: cat arg | getline' >[1=2] $awk 'BEGIN {	while (("cat " ARGV[1]) | getline x)		print x	exit}' foo.txt >foocmp -s foo.txt foo || echo 'BAD: T.getline: cat arg | getline x' >[1=2] $awk ' BEGIN { print getline <"/glop/glop/glop" } ' >fooecho '-1' >foo1cmp -s foo foo1 || echo 'BAD: T.getline: non-existent file' >[1=2] echo 'false false equal' >foo1$awk 'BEGIN {	"echo 0" | getline	if ($0) printf "true " 	else printf "false "	if ($1) printf "true " 	else printf "false "	if ($0==$1) printf "equal\n"	else printf "not equal\n"}' >foo2cmp -s foo1 foo2 || echo >[1=2] 'BAD: T.getline bad $0 type in cmd|getline' >[1=2] echo 'L1L2' | $awk 'BEGIN { $0="old stuff"; $1="new"; getline x; print}' >foo1echo 'new stuff' >foo2cmp -s foo1 foo2 || echo >[1=2] 'BAD: T.getline bad update $0' >[1=2]

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t