Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Again: using single quote within comments in script.

37 views
Skip to first unread message

Hongyi Zhao

unread,
Nov 24, 2016, 8:18:39 PM11/24/16
to
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?

Regards
--
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.

Kenny McCormack

unread,
Nov 24, 2016, 10:27:50 PM11/24/16
to
In article <o183he$ur5$1...@aspen.stu.neva.ru>,
Hongyi Zhao <hongy...@gmail.com> 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?

Do not feed the troll.

--
"Unattended children will be given an espresso and a free kitten."

Janis Papanagnou

unread,
Nov 25, 2016, 2:35:42 AM11/25/16
to
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
>

Kenny McCormack

unread,
Nov 25, 2016, 4:59:19 AM11/25/16
to
In article <o18pkd$lfl$1...@news-1.m-online.net>,
Janis Papanagnou <janis_pa...@hotmail.com> wrote:
...
>So your question is better placed in a shell newsgroup (if not already
>addressed on the page behind the link you posted above).

YHBT

--
"Everything Roy (aka, AU8YOG) touches turns to crap."
--citizens of alt.obituaries--
0 new messages