9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] sam and 'here documents' on Unix [WAS: Re: Making multiple changes to dot using sam -d]
@ 2022-05-12 17:47 Mart Zirnask
  2022-05-12 19:24 ` umbraticus
  0 siblings, 1 reply; 3+ messages in thread
From: Mart Zirnask @ 2022-05-12 17:47 UTC (permalink / raw)
  To: 9fans

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-17  5:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 17:47 [9fans] sam and 'here documents' on Unix [WAS: Re: Making multiple changes to dot using sam -d] Mart Zirnask
2022-05-12 19:24 ` umbraticus
2022-05-17  5:54   ` Mart Zirnask

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