9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] problem with a here document in rc
Date: Thu,  2 May 2013 11:24:27 -0400	[thread overview]
Message-ID: <ba51b53bc89d1beb6c6c68c0371dfcc4@ladd.quanstro.net> (raw)
In-Reply-To: <CAOEdRO1ZcGW7TnkBHhJ2+Gc3bgSViF13_1FRz3wON1aL8JG0yw@mail.gmail.com>

> s = (1 2)
> for(i in $s) {
> 	mkdir -p $i
> 	cp POSCAR $i
> 	@{
> 		cd $i
> 		ed POSCAR <<EOF >[2]/dev/null
> 	}
> }
> 2c
> $i
> .
> w
> q

i usually solve this problem like this

	for(i in 1 2){
		mkdir -p $i || fatal
		cp POSCAR $i || fatal
		@{
			{
				echo 2c
				echo $i
				echo .
				echo w
				echo q
			} | ed POSCAR
		}
	}

- erik



  reply	other threads:[~2013-05-02 15:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02 13:22 Rudolf Sykora
2013-05-02 15:24 ` erik quanstrom [this message]
2013-05-02 15:48   ` Rudolf Sykora
2013-05-06  7:27     ` Rudolf Sykora
2013-05-06 13:37       ` erik quanstrom
2013-05-07 20:40       ` Martin Kühl
2013-05-07 22:08         ` erik quanstrom
2013-05-08  2:53           ` Martin Kühl
2013-05-08  3:02             ` erik quanstrom

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=ba51b53bc89d1beb6c6c68c0371dfcc4@ladd.quanstro.net \
    --to=quanstro@quanstro.net \
    --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).