From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: From: dexen deVries Date: Thu, 26 Apr 2018 17:20:08 +0200 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset="UTF-8" Subject: Re: [9fans] simple rc problem in p9p (on OpenBSD) Topicbox-Message-UUID: d4b3e870-ead9-11e9-9d60-3106f5b1d025 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