Deutsch   English   Français   Italiano  
<vc17gi$1u8fb$2@news.xmission.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder9.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.tcl
Subject: Re: Why do we need "eval"? (Expect question)
Date: Fri, 13 Sep 2024 11:26:10 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <vc17gi$1u8fb$2@news.xmission.com>
References: <vbv03t$1t4qm$1@news.xmission.com> <vbv8kd$blsb$1@dont-email.me> <vc0ffk$ml8n$2@dont-email.me>
Injection-Date: Fri, 13 Sep 2024 11:26:10 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
	logging-data="2040299"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
Bytes: 1978
Lines: 31

In article <vc0ffk$ml8n$2@dont-email.me>, Rich  <rich@example.invalid> wrote:
>Harald Oehlmann <wortkarg3@yahoo.com> wrote:
>> spawn -noecho printf {\t%s\n} {*}$argv
>> eventually, this works to:
>> spawn -noecho printf \t%s\n {*}$argv
>
>Do note that the second one causes \t and \n to be interpreted by Tcl's 
>parser, so printf gets passed a literal tab and literal newline in its 
>parameter list.  The first passes the \ and t characters on to printf, 
>and then printf does the interpretation.
>
>Both likely work fine for printf, but may not work fine for all 
>possible external commands.
>

I think you misunderstand Harald's post (i.e., his notation).

The point is that if you pass {{\t%s\n}} to "eval", both sets of braces get
removed and what "printf" sees is (literally)

    backslash tee percent ess backslash en

If you only pass a single level of braces, and eval it, then yes, as you
said, printf will see

    tab percent ess newline

-- 
"Insisting on perfect safety is for people who don't have the balls to live
in the real world."

    - Mary Shafer, NASA Ames Dryden -