9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: dexen deVries <dexen.devries@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] simple rc problem in p9p (on OpenBSD)
Date: Thu, 26 Apr 2018 17:20:08 +0200	[thread overview]
Message-ID: <CAJUT6o45+kfag-bNtY9yGhRd-aLQM5fEzR7y3KY6RuZRGicBPQ@mail.gmail.com> (raw)
In-Reply-To: <CAOEdRO35rOrixKjZiggGFAakA341qYbRZwWODFhre1yreq_kfg@mail.gmail.com>

use a list. lists are created either by the parentheses:

% w = ( A B C )
% # note no space before the backslash
% wMultiline = (\
X\
Y\
Z\
)
% echo $w $wMultiline
A B C X Y Z
% for(i in $w) {echo $i; echo XXX}
A
XXX
B
XXX
C
XXX

or by globbing:
% text_files = *.txt

or by expanding a whitespaced text:
% text_files = `{ 9 ls *.txt }

note the p9p's "ls" quotes whitespace in file names properly for Rc

lists are single-level; merging two lists produces new one of single
level, with all the elements in order
% a = ( foo bar )
% b = ( aa $a bb )
% echo $a
foo bar
% echo $b
aa foo bar bb

side note, the ^ operator has interesting uses for lists:

% a = ( foo bar baz)
% b = ( aa bb cc )
% flat = ( first $a last )
% echo $a
foo bar baz
% echo $flat
first foo bar baz last
% car = $a ^ $b
% echo prefix ^ $a
prefixfoo prefixbar prefixbaz
% echo $car
fooaa barbb bazcc



  parent reply	other threads:[~2018-04-26 15:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26 14:45 Rudolf Sykora
2018-04-26 14:54 ` Lucio De Re
2018-04-26 15:08   ` Rudolf Sykora
2018-04-26 15:29     ` Alexander Kapshuk
2018-04-26 15:48       ` Benjamin Purcell
2018-04-26 18:36         ` Rudolf Sykora
2018-04-26 19:01           ` Costin Chirvasuta
2018-04-26 20:50             ` Rudolf Sykora
2018-05-22 19:57             ` Ethan A. Gardener
2018-04-26 14:57 ` Alexander Kapshuk
2018-04-26 15:02 ` Teodoro Santoni
2018-04-26 15:10   ` Rudolf Sykora
2018-04-26 15:20 ` dexen deVries [this message]
2018-04-26 15:31   ` Rudolf Sykora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJUT6o45+kfag-bNtY9yGhRd-aLQM5fEzR7y3KY6RuZRGicBPQ@mail.gmail.com \
    --to=dexen.devries@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).