9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] sam/rc script problem
@ 2008-12-16 12:25 Rudolf Sykora
  2008-12-16 13:02 ` lucio
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Rudolf Sykora @ 2008-12-16 12:25 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,

why do I get, running rc in linux (plan9port)

-----------------------------
; sam -d outit
 -. outit
$-/FERMI/+-
  FERMI LEVEL= 0.01     ITER= 70
q
-----------------------------

while

-----------------------------
; sam -d outit <<EOF
$-/FERMI/+-
q
EOF
 -. outit
  FERMI LEVEL= 0.07     ITER= 1
-----------------------------

that is, the second way finds the 1st occurence in the file while I
want the last one (as in the first case)?!
In Plan9 it works the same in both cases!

Thanks
Ruda

P.S.: Is there anything more intelligent than 'vt' for connecting to a
linux machine? I can't use a mouse in vt, window size change doesn't
propagate, sometimes I loose what was in the window... Simply, the
work with 'vt' (I 1st run 'vt' and then ssh to my linux machine; note
that I really need to run commands there) is very clumsy.



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

* Re: [9fans] sam/rc script problem
  2008-12-16 12:25 [9fans] sam/rc script problem Rudolf Sykora
@ 2008-12-16 13:02 ` lucio
  2008-12-16 13:08 ` Steve Simon
  2008-12-16 17:18 ` Russ Cox
  2 siblings, 0 replies; 20+ messages in thread
From: lucio @ 2008-12-16 13:02 UTC (permalink / raw)
  To: 9fans

> P.S.: Is there anything more intelligent than 'vt' for connecting to a
> linux machine? I can't use a mouse in vt, window size change doesn't
> propagate, sometimes I loose what was in the window... Simply, the
> work with 'vt' (I 1st run 'vt' and then ssh to my linux machine; note
> that I really need to run commands there) is very clumsy.

Use vncv(1), it's the only passable option.  At least, that's what I do.

++L




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

* Re: [9fans] sam/rc script problem
  2008-12-16 12:25 [9fans] sam/rc script problem Rudolf Sykora
  2008-12-16 13:02 ` lucio
@ 2008-12-16 13:08 ` Steve Simon
  2008-12-16 14:00   ` erik quanstrom
                     ` (2 more replies)
  2008-12-16 17:18 ` Russ Cox
  2 siblings, 3 replies; 20+ messages in thread
From: Steve Simon @ 2008-12-16 13:08 UTC (permalink / raw)
  To: 9fans

> P.S.: Is there anything more intelligent than 'vt' for connecting to a
> linux machine?

It all depends what you want to run on the linux box.

if you need VT in order to run your editor you could edit the file remotely
from plan9. To do this either run u9fs on the linux box, or pick up
sftpfs from contrib and use ssh. You can then import your linux boxes
namespace from plan9 (by convention put the magic in the 9fs script so its easy to do).

now you can edit files and run normal command line tools on plan9, and you only
need to use your ssh session to start programs. this (in my case at least) means I
no longer need vt and just use a rio window, so all the features of rio work
in the linx windows as elsewhere.

beware, bash can do some strange things to its output as you cut and paste long lines to it.
I usually run either a Bourne shell or Byron's rc(1) for Unix for sanity's sake.

if you get into this then you might like to take a look at rwd(1) which tries to keep
your local 'current dir' in sync with the remote one, allowing the plumber and
and filename completion to work.

It is very satisfying being able to plumb errors from a remote invocation of
gcc and see the file appear in sam on plan9.

-Steve



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

* Re: [9fans] sam/rc script problem
  2008-12-16 13:08 ` Steve Simon
@ 2008-12-16 14:00   ` erik quanstrom
  2008-12-16 14:13     ` gdiaz
  2008-12-16 14:05   ` Charles Forsyth
  2008-12-16 19:25   ` Rudolf Sykora
  2 siblings, 1 reply; 20+ messages in thread
From: erik quanstrom @ 2008-12-16 14:00 UTC (permalink / raw)
  To: 9fans

On Tue Dec 16 08:09:34 EST 2008, steve@quintile.net wrote:
> > P.S.: Is there anything more intelligent than 'vt' for connecting to a
> > linux machine?
>
> It all depends what you want to run on the linux box.
>
> if you need VT in order to run your editor you could edit the file remotely
> from plan9. To do this either run u9fs on the linux box, or pick up
> sftpfs from contrib and use ssh. You can then import your linux boxes
> namespace from plan9 (by convention put the magic in the 9fs script so its easy to do).

really, what you'd like to do is elimate the vt escapes.
p9p can take care of most of this for you.  if you use
ed for your editor, then you're all set. :-)

- erik



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

* Re: [9fans] sam/rc script problem
  2008-12-16 13:08 ` Steve Simon
  2008-12-16 14:00   ` erik quanstrom
@ 2008-12-16 14:05   ` Charles Forsyth
  2008-12-16 19:25   ` Rudolf Sykora
  2 siblings, 0 replies; 20+ messages in thread
From: Charles Forsyth @ 2008-12-16 14:05 UTC (permalink / raw)
  To: 9fans

>I usually run either a Bourne shell or Byron's rc(1) for Unix for sanity's sake.

If you use Plan 9 port's rc, and 9term, you'll find that shell windows also appear instantly, even on a Linux system.




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

* Re: [9fans] sam/rc script problem
  2008-12-16 14:00   ` erik quanstrom
@ 2008-12-16 14:13     ` gdiaz
  2008-12-16 16:22       ` Rudolf Sykora
  0 siblings, 1 reply; 20+ messages in thread
From: gdiaz @ 2008-12-16 14:13 UTC (permalink / raw)
  To: 9fans

hello

it is possible to use sam -r from aplan9 machine to a linux one? it uses ssh too in plan9 isn't it?

that could be a nice option too, if you're able to distribute sam to your hosts.

slds.

gabi



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

* Re: [9fans] sam/rc script problem
  2008-12-16 14:13     ` gdiaz
@ 2008-12-16 16:22       ` Rudolf Sykora
  2008-12-16 16:38         ` erik quanstrom
  0 siblings, 1 reply; 20+ messages in thread
From: Rudolf Sykora @ 2008-12-16 16:22 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Well,
thanks so far for answering my PS...
... but what about my main question?
:)
Has anybody encountered it?
Ruda



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

* Re: [9fans] sam/rc script problem
  2008-12-16 16:22       ` Rudolf Sykora
@ 2008-12-16 16:38         ` erik quanstrom
  2008-12-16 16:56           ` Rudolf Sykora
  0 siblings, 1 reply; 20+ messages in thread
From: erik quanstrom @ 2008-12-16 16:38 UTC (permalink / raw)
  To: 9fans

On Tue Dec 16 11:25:21 EST 2008, rudolf.sykora@gmail.com wrote:
> Well,
> thanks so far for answering my PS...
> ... but what about my main question?
> :)
> Has anybody encountered it?
> Ruda

i think rc is interpreting $ as a here document
variable and messing up.

this is one of the reasons i really don't like here
documents.  (i don't think they should be in the
shell at all.)  how about this:

echo '$-/FERMI/+-' | sam -d outit>[2]/dev/null

if you really want to use a here document, i believe
the wierdo escape is '$$'.  as in

; sam -d outit <<EOF
$$-/FERMI/+-=
EOF

- erik



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

* Re: [9fans] sam/rc script problem
  2008-12-16 16:38         ` erik quanstrom
@ 2008-12-16 16:56           ` Rudolf Sykora
  2008-12-16 17:29             ` Martin Neubauer
  0 siblings, 1 reply; 20+ messages in thread
From: Rudolf Sykora @ 2008-12-16 16:56 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> i think rc is interpreting $ as a here document
> variable and messing up.

By why then i works nicely in plan9 and not in linux, although I use
'rc' in both?
R



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

* Re: [9fans] sam/rc script problem
  2008-12-16 12:25 [9fans] sam/rc script problem Rudolf Sykora
  2008-12-16 13:02 ` lucio
  2008-12-16 13:08 ` Steve Simon
@ 2008-12-16 17:18 ` Russ Cox
  2008-12-16 17:28   ` Rudolf Sykora
  2 siblings, 1 reply; 20+ messages in thread
From: Russ Cox @ 2008-12-16 17:18 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> why do I get, running rc in linux (plan9port)
> -----------------------------
> ; sam -d outit
>  -. outit
> $-/FERMI/+-
>  FERMI LEVEL= 0.01     ITER= 70
> q
> -----------------------------
> -----------------------------
> ; sam -d outit <<EOF
> $-/FERMI/+-
> q
> EOF
>  -. outit
>  FERMI LEVEL= 0.07     ITER= 1
> -----------------------------
>
> that is, the second way finds the 1st occurence in the file while I
> want the last one (as in the first case)?!
> In Plan9 it works the same in both cases!

It works the same in both cases on Plan 9 only accidentally.
It turns out that $-/FERMI/ is the same as -/FERMI/ -- if you are
searching backward it doesn't matter whether you start at $
or at the beginning of the file.  On Plan 9:

cpu% cat <<EOF
	$-/FERMI/+-
	EOF
-/FERMI/+-
cpu%

Using the plan9port rc, I get the same behavior:

$ /usr/local/plan9/bin/rc   # plan9port rc
c2=; cat <<EOF
	$-/FERMI/+-
	EOF
-/FERMI/+-
c2=;

However, it looks like you are using Byron's Unix rc
implementation, not the plan9port one:

$ /usr/bin/rc  # byron's rc
c2=; cat <<EOF
	$-/FERMI/+-
	EOF
/FERMI/+-
c2=;

It leaves out the leading "-", which causes sam to do
a forward search and find a different line.

In all three cases, if you want to pass a $ through
uninterpreted, you should be using <<'EOF' not <<EOF.

Russ


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

* Re: [9fans] sam/rc script problem
  2008-12-16 17:18 ` Russ Cox
@ 2008-12-16 17:28   ` Rudolf Sykora
  2008-12-16 17:31     ` erik quanstrom
  0 siblings, 1 reply; 20+ messages in thread
From: Rudolf Sykora @ 2008-12-16 17:28 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> In all three cases, if you want to pass a $ through
> uninterpreted, you should be using <<'EOF' not <<EOF.
>
> Russ

Thanks, that's it.
I have now reread Pike's paper on 'rc' and it's there, too.
Ruda



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

* Re: [9fans] sam/rc script problem
  2008-12-16 16:56           ` Rudolf Sykora
@ 2008-12-16 17:29             ` Martin Neubauer
  0 siblings, 0 replies; 20+ messages in thread
From: Martin Neubauer @ 2008-12-16 17:29 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I tried your example (reduced to the to given lines) on my FreeBSD
system and got identical output both ways. So I suspect it's a linux
(or distro) thingie. I'm quite puzzled as to what could be the
cause, though.

Nevertheless, I'd still be cautious about here documents and variable
substitutions. (Maybe sam -d <<'EOF' would be better suited for
normal use.)

	Martin

* Rudolf Sykora (rudolf.sykora@gmail.com) wrote:
> > i think rc is interpreting $ as a here document
> > variable and messing up.
>
> By why then i works nicely in plan9 and not in linux, although I use
> 'rc' in both?
> R



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

* Re: [9fans] sam/rc script problem
  2008-12-16 17:28   ` Rudolf Sykora
@ 2008-12-16 17:31     ` erik quanstrom
  2008-12-16 17:48       ` Rudolf Sykora
  0 siblings, 1 reply; 20+ messages in thread
From: erik quanstrom @ 2008-12-16 17:31 UTC (permalink / raw)
  To: 9fans

> Thanks, that's it.
> I have now reread Pike's paper on 'rc' and it's there, too.
> Ruda

you mean tom duff?

- erik



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

* Re: [9fans] sam/rc script problem
  2008-12-16 17:31     ` erik quanstrom
@ 2008-12-16 17:48       ` Rudolf Sykora
  2008-12-16 18:13         ` erik quanstrom
  0 siblings, 1 reply; 20+ messages in thread
From: Rudolf Sykora @ 2008-12-16 17:48 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> you mean tom duff?
>
> - erik
 Yes, of course, tom duff's, sure.
sorry.
R



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

* Re: [9fans] sam/rc script problem
  2008-12-16 17:48       ` Rudolf Sykora
@ 2008-12-16 18:13         ` erik quanstrom
  2008-12-16 18:38           ` Charles Forsyth
  0 siblings, 1 reply; 20+ messages in thread
From: erik quanstrom @ 2008-12-16 18:13 UTC (permalink / raw)
  To: 9fans

there's a new version of byron's rc on sources and ftp://rc.quanstro.net
which fixes the $- here document bug.

the real rc a better option.

- erik



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

* Re: [9fans] sam/rc script problem
  2008-12-16 18:13         ` erik quanstrom
@ 2008-12-16 18:38           ` Charles Forsyth
  0 siblings, 0 replies; 20+ messages in thread
From: Charles Forsyth @ 2008-12-16 18:38 UTC (permalink / raw)
  To: 9fans

>the real rc a better option.

it's one of the few times when the best choice is duff software.



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

* Re: [9fans] sam/rc script problem
  2008-12-16 13:08 ` Steve Simon
  2008-12-16 14:00   ` erik quanstrom
  2008-12-16 14:05   ` Charles Forsyth
@ 2008-12-16 19:25   ` Rudolf Sykora
  2008-12-16 19:29     ` erik quanstrom
  2008-12-16 19:43     ` michael block
  2 siblings, 2 replies; 20+ messages in thread
From: Rudolf Sykora @ 2008-12-16 19:25 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> if you need VT in order to run your editor you could edit the file remotely
> from plan9. To do this either run u9fs on the linux box, or pick up
> sftpfs from contrib and use ssh. You can then import your linux boxes
> namespace from plan9 (by convention put the magic in the 9fs script so its easy to do).

I've been using this for some time.

> now you can edit files and run normal command line tools on plan9, and you only
> need to use your ssh session to start programs. this (in my case at least) means I
> no longer need vt and just use a rio window, so all the features of rio work
> in the linx windows as elsewhere.
>
> beware, bash can do some strange things to its output as you cut and paste long lines to it.
> I usually run either a Bourne shell or Byron's rc(1) for Unix for sanity's sake.

well, this doesn't work for me, even when using just 'rc' (i.e. not bash).
When not using 'vt' I get CR printed at the end of each line, I can't
read man pages, etc.
Even though your approach allows me to use a mouse for e.g. copying,
mentioned cons are just too serious.

Ruda



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

* Re: [9fans] sam/rc script problem
  2008-12-16 19:25   ` Rudolf Sykora
@ 2008-12-16 19:29     ` erik quanstrom
  2008-12-16 19:43     ` michael block
  1 sibling, 0 replies; 20+ messages in thread
From: erik quanstrom @ 2008-12-16 19:29 UTC (permalink / raw)
  To: 9fans

> well, this doesn't work for me, even when using just 'rc' (i.e. not bash).
> When not using 'vt' I get CR printed at the end of each line, I can't
> read man pages, etc.
> Even though your approach allows me to use a mouse for e.g. copying,
> mentioned cons are just too serious.

really, it's just too easy to create a script that eats crs and
other obnoxious man droppings.

- erik




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

* Re: [9fans] sam/rc script problem
  2008-12-16 19:25   ` Rudolf Sykora
  2008-12-16 19:29     ` erik quanstrom
@ 2008-12-16 19:43     ` michael block
  2008-12-16 20:14       ` Rudolf Sykora
  1 sibling, 1 reply; 20+ messages in thread
From: michael block @ 2008-12-16 19:43 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Tue, Dec 16, 2008 at 13:25, Rudolf Sykora <rudolf.sykora@gmail.com> wrote:
> When not using 'vt' I get CR printed at the end of each line, I can't
> read man pages, etc.

ssh -r should strip carriage returns. to read man pages, i set my
MANPAGER environment variable to cat or to p9p's nobs. i might be
misunderstanding your problem though

-- m



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

* Re: [9fans] sam/rc script problem
  2008-12-16 19:43     ` michael block
@ 2008-12-16 20:14       ` Rudolf Sykora
  0 siblings, 0 replies; 20+ messages in thread
From: Rudolf Sykora @ 2008-12-16 20:14 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> ssh -r should strip carriage returns. to read man pages, i set my
> MANPAGER environment variable to cat or to p9p's nobs. i might be
> misunderstanding your problem though
>
> -- m

Thanks, better now.
Ruda



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

end of thread, other threads:[~2008-12-16 20:14 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-16 12:25 [9fans] sam/rc script problem Rudolf Sykora
2008-12-16 13:02 ` lucio
2008-12-16 13:08 ` Steve Simon
2008-12-16 14:00   ` erik quanstrom
2008-12-16 14:13     ` gdiaz
2008-12-16 16:22       ` Rudolf Sykora
2008-12-16 16:38         ` erik quanstrom
2008-12-16 16:56           ` Rudolf Sykora
2008-12-16 17:29             ` Martin Neubauer
2008-12-16 14:05   ` Charles Forsyth
2008-12-16 19:25   ` Rudolf Sykora
2008-12-16 19:29     ` erik quanstrom
2008-12-16 19:43     ` michael block
2008-12-16 20:14       ` Rudolf Sykora
2008-12-16 17:18 ` Russ Cox
2008-12-16 17:28   ` Rudolf Sykora
2008-12-16 17:31     ` erik quanstrom
2008-12-16 17:48       ` Rudolf Sykora
2008-12-16 18:13         ` erik quanstrom
2008-12-16 18:38           ` Charles Forsyth

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