Subject: FVWM: simple question: how execute xterm and then a script?

From: Felix Kater <[email-masked]>
Date: Sat, 17 Aug 2002 18:22:59 +0200

Hi,
sorry for this simple question... but I can't figure that out:

I defined a Menu to start an xterm like this:

AddToMenu MenuBackup
+	"start backup"		Exec exec xterm

But how can I add something (after Exec exec xterm) to start a
scipt which shows its output in that xterm?

Bye
 Felix
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Ulrich Fahrenberg <[email-masked]>
Date: Sat, 17 Aug 2002 19:13:24 +0200 (MEST)

> scipt which shows its output in that xterm?

AddToMenu MenuBackup
+	"Test"	Exec exec xterm -e pine

works fine for me in 2.4.8 (and did in 2.2.2 too).

uli

-- 
Ulrich Fahrenberg -- http://www.math.auc.dk/~uli

---

From: Mikhael Goikhman <[email-masked]>
Date: Sat, 17 Aug 2002 18:57:03 +0000

> +	"Test"	Exec exec xterm -e pine

If your script immediatelly exits after printing the output you should
prevent xterm from being closed, something like:

  Exec exec xterm -e sh -c "date; head -1"

where "date" is your script. This waits for Enter to be closed.

Regards,
Mikhael.

---

From: "Rob 'Feztaa' Park" <[email-masked]>
Date: Sat, 17 Aug 2002 15:52:35 -0600

> where "date" is your script. This waits for Enter to be closed.

Interesting; I would have done 'read' instead of 'head -1' ;)

-- 
Rob 'Feztaa' Park
http://members.shaw.ca/feztaa/
--
Everyone was born right-handed.  Only the greatest overcome it.
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Mikhael Goikhman <[email-masked]>
Date: Sat, 17 Aug 2002 22:41:13 +0000

> Interesting; I would have done 'read' instead of 'head -1' ;)

head is more portable, read is not available in some shells like tcsh/csh.

Regards,
Mikhael.

---

From: Cameron Simpson <[email-masked]>
Date: Sun, 18 Aug 2002 09:38:23 +1000

On 22:41 17 Aug 2002, Mikhael Goikhman <[email-masked]> wrote:
| On 17 Aug 2002 15:52:35 -0600, Rob 'Feztaa' Park wrote:
| > Alas! Mikhael Goikhman spake thus:
| > > If your script immediatelly exits after printing the output you should
| > > prevent xterm from being closed, something like:
| > >   Exec exec xterm -e sh -c "date; head -1"
| > > where "date" is your script. This waits for Enter to be closed.
| > Interesting; I would have done 'read' instead of 'head -1' ;)

Me too. Doesn't even fork an extra process.

| head is more portable, read is not available in some shells like tcsh/csh.

Speaking as one who predates "head" I'd had differed on this:-) (Well, at the
least started on systems that predated "head").

True, [t]csh users can't use read. But Bourne shell users can, and should.

While we're picking nits, if one must read for an extra command, "sed q" is
even shorter. I have never liked "head" myself; "tail" I understand - it's
hard to do otherwise. But a simple:
	sed 12q
is the same as
	head -12
and shorter and easier to type. And sed definitely predates head.

Cheers,
--
Cameron Simpson, DoD#743        [email-masked]    http://www.zip.com.au/~cs/

Our job is to make the questions so painful that the only way to make the
pain go away is by thinking.	- Fred Friendly
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Mikhael Goikhman <[email-masked]>
Date: Sat, 17 Aug 2002 23:54:49 +0000

> True, [t]csh users can't use read. But Bourne shell users can, and should.

Continuing this useless discussion. If you don't want your script to fork,
use perl and <> to read a line, or use $< in tcsh, or use a portable
solution that is not language specific like using head/sed. Some unices
have utility called line that does just what "head -1" does.

Regards,
Mikhael.

---

From: Mikhael Goikhman <[email-masked]>
Date: Sun, 18 Aug 2002 00:13:53 +0000

On 18 Aug 2002 07:22:14 +0000, Bruce M Beach wrote:
> 
> On Sat, 17 Aug 2002, Mikhael Goikhman wrote:
> 
> > > I thought the ';' would work.
> >
> > Here you should remove "exec":
> >   Exec xterm &; xterm &; xterm &
> > The last & is optional, but I would leave it for symmetry.
> >
>    + "All" Exec xterm &; xterm &
> 
>    doesn't work. Nothing happens. If I remove the last xterm then an
>    xterm pops up as expected, as in
> 
>    + "All" Exec xterm &
> 
>    but if I add a semicolon
> 
>    + "All" Exec xterm &;
> 
>    then nothing happens

Funny, the following is incorrect in bash and ksh:

  % xterm &; xterm

But this is correct in tcsh, zsh, ash and csh. If you put a command
with & in parentheses it should work in all shells:

  Exec (xterm &); (xterm &); (xterm &)

On the other hand, if you need a sequence, you don't need parentheses:

  Exec xterm; xterm; xterm

Regards,
Mikhael.

---

From: Bruce M Beach <[email-masked]>
Date: Sun, 18 Aug 2002 09:55:33 +0000 (UTC)

>   Exec (xterm &); (xterm &); (xterm &)

   Yeah. I've seen the above "% xterm &; xterm" fail a million
   times and never learn because it doesn't make any sense to
   me. I think its a bug. Heres a line from a script where I use
   the semi-colon which works just fine:

       cd /usr/src; rm -rf $GCC; tar -zxvf $GCC.tar.gz;

   I guess the & confuses it. Somebody should send a report
   to [email-masked] to get clarifition. ( not me. I already
   got a bug report pending) I quickly tried this

       set -o monitor   # enable jobs
       set -b           # enable immediate reporting of SIGCHLD
       xterm &; xterm

    to enable job control and it still doesn't like it.

   Anyway the second form "Exec (xterm &); (xterm &); (xterm &)"
   does the trick. Sometimes something is funny is happening on
   the net like somebody trying to use your machine as a relay
   when they have no business doing so and I want to fire up a
   whole bunch of tails on the logs really quick. Now I can do it.

   Bruce

---

From: Cameron Simpson <[email-masked]>
Date: Sun, 18 Aug 2002 15:25:32 +1000

On 09:55 18 Aug 2002, Bruce M Beach <[email-masked]> wrote:
| On Sun, 18 Aug 2002, Mikhael Goikhman wrote:
| > Funny, the following is incorrect in bash and ksh:
| >   % xterm &; xterm
|    Yeah. I've seen the above "% xterm &; xterm" fail a million
|    times and never learn because it doesn't make any sense to
|    me. I think its a bug. Heres a line from a script where I use
|    the semi-colon which works just fine:
|        cd /usr/src; rm -rf $GCC; tar -zxvf $GCC.tar.gz;
|    I guess the & confuses it.

No, the semicolon confuses it. Try this:

	; echo foo

Works in zsh. Fails in bash:

	[cameron@amadeus cameron]$ ; echo foo
	bash: syntax error near unexpected token `;'

Their language syntax just doesn't cope with a semicolon at the start of a
command. Which is sad. 

All Bourne shells (bash, zsh etc) should cope with this:

	xterm & xterm & xterm &

because & terminates a command, so you need no separator before the next
xterm. Works in csh too.

For your amusement, bash doesn't cope with this either:

	< foo ( command )

which _ought_ to be the same as this:

	( command ) < foo

because redirections are supposed to be permitted anywhere.

Cheers,

The CBR and ZXR should come with a warning sticker that says 'You are not
Mick Doohan, do NOT be a prat'	- UK's _BIKE_ magazine
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: "Rob 'Feztaa' Park" <[email-masked]>
Date: Sat, 17 Aug 2002 21:55:25 -0600

> Funny, the following is incorrect in bash and ksh:

In bash, the syntax you are looking for is simply 'xterm & xterm'.

Feel disillusioned?  I've got some great new illusions, right here!

---

From: Bruce M Beach <[email-masked]>
Date: Sun, 18 Aug 2002 15:12:45 +0000 (UTC)

The real and simple truth is that the syntax of bash will
   just drive you crazy.

   Bruce

---

From: Bruce M Beach <[email-masked]>
Date: Sun, 18 Aug 2002 06:20:23 +0000 (UTC)

> > > + "start backup"          Exec exec xterm

      Along these lines how would some one start multiple applications?
      Consider:

AddToMenu Tails         "Tails    " Title
+ "Messages" exec xterm -fn 7x13bold -T \
       messages -fg white -bg black -j -rw -aw +sf -sl 200 -sb -e \
       tail -f /var/log/messages

      I have 5 or 6 tails that I bring up and sometimes I would like
      to bring up different groups of them. I tried

+ "All" Exec exec xterm  -fn 7x13bold -T \
                  Messages -fg white -bg black -j -rw -aw +sf -sl 200 -sb -e \
                       tail -f /var/log/messages &; \
                  xterm  -fn 7x13bold -T \
                     Syslog -fg white -bg black -j -rw -aw +sf -sl 200 -sb -e \
                        tail -f /var/log/syslog  &
   I thought the ';' would work.

   By the way I have a very unusual problem with fvwm-2.5.2. It just
   occurred while I was writing this email. And its this kind of problem.
   Intermittent, (i.e. occurs every couple of days.) It seem to occur under
   heavy load, and perhaps is connected with a large amount of output to an
   xterm. What happens is that the output to the xterm freezes, until I bring
   the mouse into the xterm (FocusFollowsMouse) then every everything is back
   to normal. This time was unusual because I happened to have 'top' running.
   The processors were about 75% usage (say), the output stopped in an xterm
   and the processors wentt o to 100.0% idle,  (I was doing a series of builds)
   I typed this letter for a while and finally moved the mouse into the xterm.
   The builds started up again and the processors went back to 75% usage again.
   What I didn't do, I'm sorry to say was type 'ps x' to see what it said.
   I know that fvwm-2.5.2 is development, but I need to use it because it
   fixes some serious problems that occurred with an upgrade to xwindows 4.2
   fvwm-2.5.2 seems to work fine anyway. I haven't been on the site for
   a while to see what the latest is.

   Bruce

---

From: Mikhael Goikhman <[email-masked]>
Date: Sat, 17 Aug 2002 22:37:43 +0000

If you use shell controls like ";", "&", "()", "|", where a shell should
spawn additional processes, you should do this in "Exec" not "Exec exec".

Another solutions to your problem are: instead of writting several shell
commands in one line, create a small shell script and call it, or create
a function with multiple "Exec exec" commands.

> xterm. What happens is that the output to the xterm freezes, until I
> bring the mouse into the xterm (FocusFollowsMouse) then every everything
> is back to normal. This time was unusual because I happened to have
> 'top' running. The processors were about 75% usage (say), the output
> stopped in an xterm and the processors wentt o to 100.0% idle, (I was
> doing a series of builds) I typed this letter for a while and finally
> moved the mouse into the xterm. The builds started up again and the
> processors went back to 75% usage again. What I didn't do, I'm sorry to
> say was type 'ps x' to see what it said. I know that fvwm-2.5.2 is
> development, but I need to use it because it fixes some serious problems
> that occurred with an upgrade to xwindows 4.2 fvwm-2.5.2 seems to work
> fine anyway. I haven't been on the site for a while to see what the
> latest is.

Try to narrow the problem and make it reproducible, so that others can see
this too.

Regards,
Mikhael.

---

From: Bruce M Beach <[email-masked]>
Date: Sun, 18 Aug 2002 07:22:14 +0000 (UTC)

+ "All" Exec xterm &

   but if I add a semicolon

   + "All" Exec xterm &;

   then nothing happens

> > Intermittent, ..........
   Tricky, only thing I can think of is 'ps x' to see if the process's
   are stopped. It seems that as long as I don't move into the mouse
   into the window it stay in that state. All other windows are functional.
   The question is what to examine. Suggestions are welcome.

   Bruce

---

From: "Rob 'Feztaa' Park" <[email-masked]>
Date: Mon, 19 Aug 2002 11:32:23 -0600

>    xterm pops up as expected, as in

Didn't we just go through this on another thread? The syntax you are
looking for is this:

+ "All" Exec xterm & xterm &

Sometimes the best medicine is to stop taking something.

---

From: Bruce M Beach <[email-masked]>
Date: Tue, 20 Aug 2002 07:28:58 +0000 (UTC)

> + "All" Exec xterm & xterm &

   Yes, and for reasons not understood the original emails appeared
   appeared out of nowhere from the list, or I sent them again
   without being aware of it.

   Bruce

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 20 Aug 2002 01:10:45 +0000

>    without being aware of it.

One of my messages was moderated, because it had 4 recipients listed (good
to know). It took a day for everyone to get it, but 3 other recipients got
it immediatelly, so we continued the discussion without waiting for the
parent message to appear on the list.

The messages from the list have a special signature. You may disable
duplicated emails if this helps (man procmailex).

Regards,
Mikhael.

---

From: "Rob 'Feztaa' Park" <[email-masked]>
Date: Mon, 19 Aug 2002 23:46:53 -0600

> without being aware of it.

Sorry, I was being a bit impatient. Mikhail (sp? sorry) explained that
due to moderation, messages arrive out of order. No other list I know is
like this ;)

The Abrams' Principle:
	The shortest distance between two points is off the wall.

---

From: Jason L Tibbitts III <[email-masked]>
Date: 20 Aug 2002 09:24:06 -0500

>>>>> "RP" == Rob Park <Rob> writes:

RP> Sorry, I was being a bit impatient. Mikhail (sp? sorry) explained
RP> that due to moderation, messages arrive out of order. No other
RP> list I know is like this ;)

Anything which trips the filters gets sent to me for approval.  It can
occasionally take me a little while to approve things, especially when
they come in while I'm asleep.  The filters are extensive.  Why do you
think this list sees so little spam when anyone can post to it?  Spam
and viruses sent to the list outnumber legitimate traffic by a factor
of at least five to one.

Pretty much every list works like this, except for the lists that just
throw away messages which trip the filters (leading to messages which
are lost instead of delayed).

 - J<

---

From: "Rob 'Feztaa' Park" <[email-masked]>
Date: Tue, 20 Aug 2002 11:26:31 -0600

Alas! Jason L Tibbitts III spake thus:
> Why do you think this list sees so little spam when anyone can post to
> it?

I have seen a number of lists in which anybody subscribed can post
without restriction, but messages that come from people who are not
subscribed are either a) rejected or b) sent to the list admin for
approval.

Since I've *never* seen a spammer who subscribes to mailing lists just
to spam them (unless you want to start talking about trolls, but that's
different), then that method works very well. I had just assumed that
this list works the same way, and since we were all subscribed, none of
our posts would be moderated.

I guess both methods have their merits, though.

"I would have made a good Pope."
    -- Richard Nixon

---

From: Cameron Simpson <[email-masked]>
Date: Wed, 21 Aug 2002 09:48:40 +1000

On 11:26 20 Aug 2002, Rob 'Feztaa' Park <[email-masked]> wrote:
| Alas! Jason L Tibbitts III spake thus:
| > Why do you think this list sees so little spam when anyone can post to
| > it?
| 
| I have seen a number of lists in which anybody subscribed can post
| without restriction, but messages that come from people who are not
| subscribed are either a) rejected or b) sent to the list admin for
| approval.
| 
| Since I've *never* seen a spammer who subscribes to mailing lists just
| to spam them (unless you want to start talking about trolls, but that's
| different), then that method works very well. [...]

As postmaster where I work, I've seen several subscription attempts from
spammers, presumably a prelude to actual spam. Seems to have dropped off -
common a couple of years ago, nothing recently.
-- 
Cameron Simpson, DoD#743        [email-masked]    http://www.zip.com.au/~cs/

Did you ever hear anyone say 'that work had better be banned because I might
read it and it might be very damaging to me'?
- Joseph Henry Jackson, American Journalist, 1894-1946
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].