9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Ciprian Dorin, Craciun" <ciprian.craciun@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] rc shell UNIX port repository
Date: Mon, 14 Dec 2009 18:33:47 +0200	[thread overview]
Message-ID: <8e04b5820912140833m58c575d0x92030d2e7fc1b3ce@mail.gmail.com> (raw)
In-Reply-To: <c6e191f39d1cb2c4b12517a318a2b34b@coraid.com>

On Mon, Dec 14, 2009 at 6:14 PM, erik quanstrom <quanstro@coraid.com> wrote:
>>     One for example (I think it is a bug, but maybe in the semantics
>> you've described it's not):
>>     * again if we're using `-e`, and inside a function we write `fn
>> dosomething { echo 1 ; false ; echo 2 ; return 0 ; }`
>>     * if we run `dosomething` it shall output only `1`, as the false
>> breaks the execution;
>>     * but if we run `dosomething || echo 3`, we see `1 2` outputed,
>> because the false is not exiting the shell as the invocation of the
>> function is part of a `||` statement;
>
> not a bug.  x || y is "line" in the rc grammar.  "x;" is als o a line.
> -e is only evaluated at the end of lines.

    I see... (But I keep my opinion about the overly-complex `-e` semantics...)


>>     But undoubtedly, the following is a bug (I have an array and want
>> to display all the elements on a single line, wrapped inside quotes,
>> and everything with a prefix and a suffix):
> [...]
>
>> ifs='\n' echo '  erl files = ('^`{ echo -n
>> '`'^$application__erl_files__short^'`' }^')'
>> ifs='\n' echo '  erl files = ('^`{ echo -n
>> '`'^$application__erl_files__long^'`' }^')'
>> ~~~~
>>     it displays:
>> ~~~~
>>   erl files = (`a.erl` `b.erl` `c.erl`)
>>   erl files = (`/home/cipria)   erl files = (/workbe)   erl files =
>> (ch/vel/a.erl` `/home/cipria)   erl files = (/workbe)   erl files =
>> (ch/vel/b.erl` `/home/cipria)   erl files = (/workbe)   erl files =
>> (ch/vel/c.erl`)
>> ~~~~
>
> not a bug.  you set the ifs to '\' and 'n'.  since the first
> list doesn't have any ns in it, it doesn't get split.
> to get a newline in rc you need
> ifs='
> ' cmd
>
> - erik


    ???? So then how can I say on the same line
ifs=<<new-line-character>> ???? (I know about the actual newline
between the quotes, but I think it's a very ugly syntax, especially
when it involves indentation...)



  reply	other threads:[~2009-12-14 16:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<8e04b5820912140211nd4edf3ei851c5a5128438d96@mail.gmail.com>
2009-12-14 14:08 ` erik quanstrom
2009-12-14 15:15   ` Ciprian Dorin, Craciun
2009-12-14 16:14     ` erik quanstrom
2009-12-14 16:33       ` Ciprian Dorin, Craciun [this message]
2009-12-14 16:44         ` erik quanstrom
     [not found] <<0d3820e90fedfa15c374652fe64f06b4@ladd.quanstro.net>
2009-12-14 14:14 ` erik quanstrom
     [not found] <<8e04b5820912052352w304556cdufac28cc2dd3f9ffe@mail.gmail.com>
2009-12-06 15:24 ` erik quanstrom
2009-12-06  7:52 Ciprian Dorin, Craciun
2009-12-06 11:36 ` Charles Forsyth
2009-12-06 12:58   ` Ciprian Dorin, Craciun
2009-12-06 13:37     ` Frederik Caulier
2009-12-06 13:37     ` Charles Forsyth
2009-12-06 18:38 ` Axel Belinfante
2009-12-14  9:49 ` weakish
2009-12-14 10:11   ` Ciprian Dorin, Craciun

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=8e04b5820912140833m58c575d0x92030d2e7fc1b3ce@mail.gmail.com \
    --to=ciprian.craciun@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).