On 25.11.2016 02:18, Hongyi Zhao wrote:
> Hi all,
>
> I read the excellent notes here:
>
>
http://awk.freeshell.org/PrintASingleQuote
>
> But, I still cann't figure out why when a single quote used within
> comments in script, say, the following:
>
> # blabla ' blabla.
>
> It will trigger an error.
>
> IMO, the # denotes that the line is comments and will not be executed,
> why still I cann't put literal single quote in it?
You are obviously judging it from a awk-language point of view, and not
from the calling shell-environment point of view. An awk program like
{ print } # ' comment
works as expected; if it's in a file p and called like this: awk -f p
But if you are in shell context first the shell rules to parse the code
apply. And you obviously will have an issue parsing code like this
awk '{ print } # ' comment'
So your question is better placed in a shell newsgroup (if not already
addressed on the page behind the link you posted above).
Janis
>
> Regards
>