문제

If this is good awk syntax

awk '{if (0) {print""}}'

and so is this

awk '{if (0) print""; else print ""}'

, then why is this bad syntax??

awk '{if (0) {print""}; else print ""}'
도움이 되었습니까?

해결책

Because the awk conditional syntax is (among others)

if condition compound-statement else compound-statement

Just as in C, by the way. This makes

if condition compound-statement ';' else compound-statement

an error.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top