Subject: FVWM: PipeRead help

From: Johan Svedberg <[email-masked]>
Date: Sat, 7 Sep 2002 23:28:29 +0200

Hi, all.

I need some help. What I want to do is check if a program is on my
system, and if it is I want to run it in my InitFunction. I'm guessing
this could be done in a Function using PipeRead, but I have no idea how
to do it... :-) Help would be greatly appriciated.

Regards, Johan Svedberg

-- 
|Mail address   |Home telephonenumber    |E-mail address               |
|Johan Svedberg |+46 (0)90 - 49 139      [email-masked]            |
|Hästhagsvägen 2|                        |                             |
|S-905 96 Umeå  |Cellular telephonenumber|WWW address                  |
|Sweden         |+46 (0)70 - 639 49 82   |http://www.acc.umu.se/~winkle|
                                                                      --
--
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, 7 Sep 2002 22:49:27 +0000

> to do it... :-) Help would be greatly appriciated.

Do what you would do from a script or command line. Something like this:

  Exec which myprogram >/dev/null 2>&1 && myprogram params

Some propretary unices (Solaris) have pretty unusable "which" that always
returns 0 and write errors on stdout. There are also "whereis" (external),
"where", "filetest -X" (tcsh/csh), "hash", "type" (sh).

Regards,
Mikhael.

---

From: Cameron Simpson <[email-masked]>
Date: Sun, 8 Sep 2002 11:43:33 +1000

On 22:49 07 Sep 2002, Mikhael Goikhman <[email-masked]> wrote:
| On 07 Sep 2002 23:28:29 +0200, Johan Svedberg wrote:
| > I need some help. What I want to do is check if a program is on my
| > system, and if it is I want to run it in my InitFunction. I'm guessing
| > this could be done in a Function using PipeRead, but I have no idea how
| > to do it... :-) Help would be greatly appriciated.
| 
| Do what you would do from a script or command line. Something like this:
| 
|   Exec which myprogram >/dev/null 2>&1 && myprogram params
| 
| Some propretary unices (Solaris) have pretty unusable "which" that always
| returns 0 and write errors on stdout. There are also "whereis" (external),
| "where", "filetest -X" (tcsh/csh), "hash", "type" (sh).

Any reason not just to do this:

	Exec myprogram params

If it's there, it runs. If not, it doesn't.

Of course, if you want to do a bit more than just invoke it
then Mikhael's approach is the go. If your "which" always returns 0 you
can try this:

	Exec prog=`which myprogram 2>/dev/null`; [ -f "$$prog" ] && myprogram params

i.e. doesn't trust which's exit status - test the string it returns. The
double $$ is to get the $ through to the shell from FVWM (which also
uses $).
-- 
Cameron Simpson, DoD#743        [email-masked]    http://www.zip.com.au/~cs/

As long as you're willing to distract people with odd host names, the British
Indian Ocean Territory appears to be a safe bet; unlike .cv, .cm, and .vg,
there is still no name service for .io, making it ripe for fictional hosts.
According to my almanac, it contains the Chagos Archipelago, with a surface
area of 23 square miles and no civilian population whatsoever, although both
the UK and the US "maintain a military presence". Presumably any computers it
contains will be in .mil or .uk. - Elizabeth Zwicky <[email-masked]>
--
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].