f



Again: using single quote within comments in script.

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 :.
0
Hongyi
11/25/2016 1:18:38 AM
comp.lang.awk 3450 articles. 0 followers. Post Follow

3 Replies
194 Views

Similar Articles

[PageSpeed] 3

In article <o183he$ur5$1@aspen.stu.neva.ru>,
Hongyi Zhao  <hongyi.zhao@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."
0
gazelle
11/25/2016 3:27:48 AM
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
> 

0
Janis
11/25/2016 7:35:41 AM
In article <o18pkd$lfl$1@news-1.m-online.net>,
Janis Papanagnou  <janis_papanagnou@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
gazelle
11/25/2016 9:59:18 AM
Reply: