Re: [9fans] simple rc problem in p9p (on OpenBSD)

2018-06-13 Thread Ethan A. Gardener
On Thu, Apr 26, 2018, at 8:01 PM, Costin Chirvasuta wrote:
> I lot of the messages on this list end up being marked as spam. I
> believe there was a previous discussion about this.

I've had no trouble with this list on fastmail.fm , for what it's worth.



Re: [9fans] simple rc problem in p9p (on OpenBSD)

2018-04-26 Thread Rudolf Sykora
On Thu, 26 Apr 2018 at 21:41, Costin Chirvasuta  wrote:

> I lot of the messages on this list end up being marked as spam. I
> believe there was a previous discussion about this.

Well, I did check my spam folder. (Actually all folders...)
It hasn't been delivered at all...

Thanks
Ruda



Re: [9fans] simple rc problem in p9p (on OpenBSD)

2018-04-26 Thread Costin Chirvasuta
I lot of the messages on this list end up being marked as spam. I
believe there was a previous discussion about this.

On Thu, Apr 26, 2018 at 7:36 PM, Rudolf Sykora  wrote:
> On 26 April 2018 at 17:48, Benjamin Purcell  wrote:
>> Since no one had any idea what you had in mind, here is stab in the
>> dark. Did you want
>>
>> % for(i in `{echo $w}) {echo $i; echo XXX}
>
> Yes. That was it.
> But basically this was already given in Teodoro Santoni's
> e-mail.
>
>> On Thu, Apr 26, 2018 at 11:29 AM, Alexander Kapshuk
>>  wrote:
>>> You could initialise $w to hold a list of files output by ls like so:
>>> % w=`{ls}
>>> % echo $#w
>>> 40
>>>
>>> Is this what you had in mind?
>
> I am puzzled now. I actually did not get Alexander Kapshuk's
> e-mail, it was not delivered to my gmail account. (But it is
> present at https://marc.info/?l=9fans=1=201804=2 ).
> (And it seems you might have not received Santoni's e-mail.)
> I don't know what's happening here.
>
> Thanks
> Ruda
>



Re: [9fans] simple rc problem in p9p (on OpenBSD)

2018-04-26 Thread Rudolf Sykora
On 26 April 2018 at 17:48, Benjamin Purcell  wrote:
> Since no one had any idea what you had in mind, here is stab in the
> dark. Did you want
>
> % for(i in `{echo $w}) {echo $i; echo XXX}

Yes. That was it.
But basically this was already given in Teodoro Santoni's
e-mail.

> On Thu, Apr 26, 2018 at 11:29 AM, Alexander Kapshuk
>  wrote:
>> You could initialise $w to hold a list of files output by ls like so:
>> % w=`{ls}
>> % echo $#w
>> 40
>>
>> Is this what you had in mind?

I am puzzled now. I actually did not get Alexander Kapshuk's
e-mail, it was not delivered to my gmail account. (But it is
present at https://marc.info/?l=9fans=1=201804=2 ).
(And it seems you might have not received Santoni's e-mail.)
I don't know what's happening here.

Thanks
Ruda



Re: [9fans] simple rc problem in p9p (on OpenBSD)

2018-04-26 Thread Benjamin Purcell
Since no one had any idea what you had in mind, here is stab in the
dark. Did you want

% for(i in `{echo $w}) {echo $i; echo XXX}

?

On Thu, Apr 26, 2018 at 11:29 AM, Alexander Kapshuk
 wrote:
> On Thu, Apr 26, 2018 at 6:08 PM, Rudolf Sykora  
> wrote:
>> On 26 April 2018 at 16:54, Lucio De Re  wrote:
>>> w=(A B C)
>>>
>>> ?
>>
>> 1) this is not an answer
>> 2) the use of it all was that I wanted to send to print
>> certain files, the list of which I got from ls followed
>> by manual deletion (in 9term) of some... Newline separation
>> is thus natural.
>>
>> Thanks anyway
>> Ruda
>>
>
> You could initialise $w to hold a list of files output by ls like so:
> % w=`{ls}
> % echo $#w
> 40
>
> Is this what you had in mind?
>



Re: [9fans] simple rc problem in p9p (on OpenBSD)

2018-04-26 Thread Rudolf Sykora
On 26 April 2018 at 17:20, dexen deVries  wrote:
> use a list. lists are created either by the parentheses:
>
> % w = ( A B C )
> % # note no space before the backslash
> % wMultiline = (\
> X\
> Y\
> Z\
> )

As I wrote in another answer, the content of w is as if pre-given.
I didn't want to edit it in any way (like adding the \ characters).
I wanted ifs to do the work.

Thanks
Ruda



Re: [9fans] simple rc problem in p9p (on OpenBSD)

2018-04-26 Thread Alexander Kapshuk
On Thu, Apr 26, 2018 at 6:08 PM, Rudolf Sykora  wrote:
> On 26 April 2018 at 16:54, Lucio De Re  wrote:
>> w=(A B C)
>>
>> ?
>
> 1) this is not an answer
> 2) the use of it all was that I wanted to send to print
> certain files, the list of which I got from ls followed
> by manual deletion (in 9term) of some... Newline separation
> is thus natural.
>
> Thanks anyway
> Ruda
>

You could initialise $w to hold a list of files output by ls like so:
% w=`{ls}
% echo $#w
40

Is this what you had in mind?



Re: [9fans] simple rc problem in p9p (on OpenBSD)

2018-04-26 Thread dexen deVries
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



Re: [9fans] simple rc problem in p9p (on OpenBSD)

2018-04-26 Thread Rudolf Sykora
On 26 April 2018 at 17:02, Teodoro Santoni  wrote:
> ; w='A
> B
> C'
> ; we=`{echo $w}
> ; for(i in $we) { echo 'arg '$i; }
> arg A
> arg B
> arg C
> ; for(i in $w) { echo 'arg'$i; }
> argA
> B
> C
> ; exit
>
> When enclosed in single quotes, the variable is, regardless of spaces
> or whatnot, a single element. For a list you have to expand it in some
> way, inside a command expansion or declaring a list.
>

Thanks, this is it.
Ruda



Re: [9fans] simple rc problem in p9p (on OpenBSD)

2018-04-26 Thread Rudolf Sykora
On 26 April 2018 at 16:54, Lucio De Re  wrote:
> w=(A B C)
>
> ?

1) this is not an answer
2) the use of it all was that I wanted to send to print
certain files, the list of which I got from ls followed
by manual deletion (in 9term) of some... Newline separation
is thus natural.

Thanks anyway
Ruda



Re: [9fans] simple rc problem in p9p (on OpenBSD)

2018-04-26 Thread Teodoro Santoni
Hi,

2018-04-26 16:45 GMT+02:00, Rudolf Sykora :
> Hello
>
> I, using OpenBSD's p9p, see this
>
> % w='A
> B
> C'
> % echo $w
> A
> B
> C
> % for(i in $w) {echo $i; echo XXX}
> A
> B
> C
> XXX
>
> ie, w in for is taken as just one argument instead of
> 3. What can I do with it?
>
> I haven't modified ifs (it should be \n space and tab).
> (How can I check, say see the character codes?)
>
> Thanks for comments
> Ruda
>
>

; w='A
B
C'
; we=`{echo $w}
; for(i in $we) { echo 'arg '$i; }
arg A
arg B
arg C
; for(i in $w) { echo 'arg'$i; }
argA
B
C
; exit

When enclosed in single quotes, the variable is, regardless of spaces
or whatnot, a single element. For a list you have to expand it in some
way, inside a command expansion or declaring a list.



Re: [9fans] simple rc problem in p9p (on OpenBSD)

2018-04-26 Thread Alexander Kapshuk
On Thu, Apr 26, 2018 at 5:45 PM, Rudolf Sykora  wrote:
> Hello
>
> I, using OpenBSD's p9p, see this
>
> % w='A
> B
> C'
> % echo $w
> A
> B
> C
> % for(i in $w) {echo $i; echo XXX}
> A
> B
> C
> XXX
>
> ie, w in for is taken as just one argument instead of
> 3. What can I do with it?
>
> I haven't modified ifs (it should be \n space and tab).
> (How can I check, say see the character codes?)
>
> Thanks for comments
> Ruda
>

Here, $w's value is a string.
% w='A
B
C'
% echo $#w
1

And here, it's a list.
% w=(A B C)
% echo $#w
3
% for(i in $w) {echo $i; echo XXX}
A
XXX
B
XXX
C
XXX



Re: [9fans] simple rc problem in p9p (on OpenBSD)

2018-04-26 Thread Lucio De Re
w=(A B C)

?


On 4/26/18, Rudolf Sykora  wrote:
> Hello
>
> I, using OpenBSD's p9p, see this
>
> % w='A
> B
> C'
> % echo $w
> A
> B
> C
> % for(i in $w) {echo $i; echo XXX}
> A
> B
> C
> XXX
>
> ie, w in for is taken as just one argument instead of
> 3. What can I do with it?
>
> I haven't modified ifs (it should be \n space and tab).
> (How can I check, say see the character codes?)
>
> Thanks for comments
> Ruda
>
>


-- 
Lucio De Re
2 Piet Retief St
Kestell (Eastern Free State)
9860 South Africa

Ph.: +27 58 653 1433
Cell: +27 83 251 5824
FAX: +27 58 653 1435