[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hello, world!\n



fischer wrote
> am i the only person in the biz who uses es(local) as a login shell
> and, moreover, would be bold enough to post to this mailing list?

No, but the list often has substantial delays before messages are
delivered.  Since traffic tends to be on the order of a couple of
messages a week, this isn't usually an issue.

> now for the good part:  it may happen to you as well, that you input a
> list of integers like this:
> 
> i = <=%read
> 
> ...and want to use it like this:
> 
> echo $list($i)
> 
> ...just to see that only one single little value will be returned, the
> first one called for in the indice-list.  have no fear, because i got
> the solution.  when reading several values using %read, they will be
> returned in one simple flat value.  to index a list you would rather
> want several distinguishable values, and it happens like this:
> 
> i = <=%read; i = `{echo $i}
> echo $list($i)
> 
> ...then will work as expected.

%read is a really, really flakey part of es to be using.  If you want to
use it and not go through the backquote mechanism, you could use:

  i = <={ %fsplit ' '\t <=%read }

But it's probably much better to use an external program like line,
which reads a single line of input, prints it, and exits.  If you can't
find line on your system or in some unix tools archive, this should work:

  i = `{ awk '{ print $0; exit }' /dev/tty }

--p