9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Mart Zirnask <martzirnask@gmail.com>
To: 9fans <9fans@9fans.net>
Subject: [9fans] sam and 'here documents' on Unix [WAS: Re: Making multiple changes to dot using sam -d]
Date: Thu, 12 May 2022 20:47:46 +0300	[thread overview]
Message-ID: <CAHUAchw8bMi9az4=YvnV+=8Gq0VCkcSoqjvY57M1z-U59EbYZg@mail.gmail.com> (raw)

A related question:
9front sam has the ^ command, which makes it easy to apply multiple
sam commands to the dot from a script, e.g:

cat << END
,x/red/ c/blue/
,x/yellow/ c/green/

How does one accomplish this in oldschool Unix sam -d without the ^
command, and also without using ssam?

'Here dcuments' work, because the following works fine on my shell
(Busybox sh, not rc):

$ sam -d file.txt << END
,x/red/ c/blue/
,x/yellow/ c/green/

However, piping dot to that script from within sam -d (using the |
command) ends up with:
sh: script.sh: not found
?warning: exit status not 0

...and also an empty (deleted) sam buffer.

Replacing 'cat' with other options, e.g. 'sam -d "$*"', eventually
gave a "broken pipe" message. And, again, in all cases, an empty

So, no ^ command, no ssam, but want to use substitutions from 'here
documents' -- where am I going wrong?
Many thanks,

On 11/05/2022, revcomninos@gmail.com <revcomninos@gmail.com> wrote:
> Thank you! I was erring in that I failed to repeat x.

9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tcf06324837558cea-M5ef5eba93c3c87f8333b2b8e
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

             reply	other threads:[~2022-05-12 17:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-12 17:47 Mart Zirnask [this message]
2022-05-12 19:24 ` umbraticus
2022-05-17  5:54   ` Mart Zirnask

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:

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

  git send-email \
    --in-reply-to='CAHUAchw8bMi9az4=YvnV+=8Gq0VCkcSoqjvY57M1z-U59EbYZg@mail.gmail.com' \
    --to=martzirnask@gmail.com \
    --cc=9fans@9fans.net \
    --subject='[9fans] sam and '\''here documents'\'' on Unix [WAS: Re: Making multiple changes to dot using sam -d]' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).