9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] rc script question
@ 2013-02-27 15:41 Steve Simon
  2013-02-27 15:53 ` Charles Forsyth
  2013-02-27 16:06 ` dexen deVries
  0 siblings, 2 replies; 4+ messages in thread
From: Steve Simon @ 2013-02-27 15:41 UTC (permalink / raw)
  To: 9fans

Hi,

rc is not working how I expect it to.

This works fine
	echo a b c | rc -c 'a=`{read}; echo @ $a(2-) @'
	@ b c @

This i did not expect
	echo a b c | rc -c 'echo @ $(2-) @'
	@ @

Perhaps I need some expectation managment?

-Steve



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] rc script question
  2013-02-27 15:41 [9fans] rc script question Steve Simon
@ 2013-02-27 15:53 ` Charles Forsyth
  2013-02-27 16:06 ` dexen deVries
  1 sibling, 0 replies; 4+ messages in thread
From: Charles Forsyth @ 2013-02-27 15:53 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 605 bytes --]

i assumed you wanted a b c as command line arguments in the second case,
not echoed in.
in the first case, you indexed a variable. in the second case, you indexed
nothing.

% rc -c 'echo @ $*(2-) @' a b c
@ b c @



On 27 February 2013 15:41, Steve Simon <steve@quintile.net> wrote:

> Hi,
>
> rc is not working how I expect it to.
>
> This works fine
>         echo a b c | rc -c 'a=`{read}; echo @ $a(2-) @'
>         @ b c @
>
> This i did not expect
>         echo a b c | rc -c 'echo @ $(2-) @'
>         @ @
>
> Perhaps I need some expectation managment?
>
> -Steve
>
>

[-- Attachment #2: Type: text/html, Size: 1100 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] rc script question
  2013-02-27 15:41 [9fans] rc script question Steve Simon
  2013-02-27 15:53 ` Charles Forsyth
@ 2013-02-27 16:06 ` dexen deVries
  2013-03-01 10:28   ` Yaroslav
  1 sibling, 1 reply; 4+ messages in thread
From: dexen deVries @ 2013-02-27 16:06 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Wednesday 27 of February 2013 15:41:58 Steve Simon wrote:
> This i did not expect
> 	echo a b c | rc -c 'echo @ $(2-) @'
> 	@ @


rc -c 'shift; echo @ $* @' `{echo a b c}

surprisingly, * can be assigned to.

echo a b c | rc -c '*=`{read}; shift; echo @ $* @'
echo a b c | rc -c '*=`{read}; echo @ $*(2-) @'

-- 
dexen deVries

[[[↓][→]]]





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] rc script question
  2013-02-27 16:06 ` dexen deVries
@ 2013-03-01 10:28   ` Yaroslav
  0 siblings, 0 replies; 4+ messages in thread
From: Yaroslav @ 2013-03-01 10:28 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 96 bytes --]

> surprisingly, * can be assigned to.
>

and this is why there's no bourne's "set" builtin.

[-- Attachment #2: Type: text/html, Size: 356 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-01 10:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-27 15:41 [9fans] rc script question Steve Simon
2013-02-27 15:53 ` Charles Forsyth
2013-02-27 16:06 ` dexen deVries
2013-03-01 10:28   ` Yaroslav

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).