So I have a simple shell script called try.sh:
#! /bin/ksh
echo "'" | awk '
/'\''/ {
print "'\''ello, world"
}
'
and it runs fine:
$ ./try.sh
'ello, world
But ksh -n is not altogether happy with it:
$ ksh -n ./try.sh
./try.sh: warning: line 3: ' quote may be missing
./try.sh: warning: line 5: ' quote may be missing
I can use tricks (awk variables, awk hex sequences, etc.) to make this go away, but surely there's some native elegant way to appease the ksh syntax checker (if nothing else, for the case when the embedded language has no provision for workarounds). What am I forgetting?
[update: apparently the syntax checker is flagging the line because a quoted string with embedded newline is followed by another quoted string with no intervening white space. David Korn says that he'll be reviewing the check for the next version of ksh. See the ast-users mailing list archives for details.]