Discussion:
[9fans] rc script question
(too old to reply)
Steve Simon
2013-02-27 15:41:58 UTC
Permalink
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
Charles Forsyth
2013-02-27 15:53:47 UTC
Permalink
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 @
Post by Steve Simon
Hi,
rc is not working how I expect it to.
This works fine
@ b c @
This i did not expect
@ @
Perhaps I need some expectation managment?
-Steve
dexen deVries
2013-02-27 16:06:35 UTC
Permalink
Post by Steve Simon
This i did not expect
@ @
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

[[[↓][→]]]
Yaroslav
2013-03-01 10:28:12 UTC
Permalink
Post by dexen deVries
surprisingly, * can be assigned to.
and this is why there's no bourne's "set" builtin.

Loading...