Subject: FVWM: PipeRead problem

From: Norvell Spearman <[email-masked]>
Date: Tue, 19 Nov 2002 20:45:20 -0600

fvwm-2.5.4

I have the following line in a configuration file

PipeRead 'for i in Menu/*.men; do echo read $i; done'

which produces the following error message in my ~/.xsession-errors:

[FVWM][Read]: <<ERROR>> file 'Menu/*.men' not found in \
/home/norvell/.fvwm or /usr/share/fvwm

Yet there is a directory in my .fvwm directory named Menu in which are
files with men as the extension.  If I change the PipeRead command to:

PipeRead 'for i in $HOME/.fvwm/Menu/*.men; do echo read $i; done'

fvwm does what I need it to.  What's wrong with my first PipeRead?
Thanks for any answers.

-- 
Norvell Spearman
--
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: Dan Espen <[email-masked]>
Date: Tue, 19 Nov 2002 23:30:45 -0500

> PipeRead 'for i in Menu/*.men; do echo read $i; done'

The for i in part is relative to $HOME.
The fvwm read command reads in $HOME/.fvwm.

If you change the first part to .fvwm/Menu/*.man
it will screw up $i for the read.

> fvwm does what I need it to.  What's wrong with my first PipeRead?

I think you'll find full paths work better.

Another way to refer to "$HOME/.fvwm" is $FVWM_USERDIR.

-- 
Dan Espen                           E-mail: [email-masked]

---

From: Norvell Spearman <[email-masked]>
Date: Tue, 19 Nov 2002 22:11:37 -0600

> The fvwm read command reads in $HOME/.fvwm.

Pardon my ignorance, but I still don't quite understand.  How is the
``for i in'' part relative to $HOME when the error message says:

Doesn't that suggest that fvwm starts looking in $HOME/.fvwm for i (but
doesn't see it), then in /usr/share/fvwm, before looking in $HOME?

> I think you'll find full paths work better.

That's what I'll end up doing.  I'll eventually change the script
commands to look in /usr/share/fvwm, then in $FVWM_USERDIR.  I'm working
on a klugey approach to menu configuration:  one file per app, each
file containing both menu entry and style commands.  Thanks for your
help and for responding so quickly.

---

From: Dan Espen <[email-masked]>
Date: Wed, 20 Nov 2002 00:42:56 -0500

> /home/norvell/.fvwm or /usr/share/fvwm

You still see the "*" in the file name because the shell didn't
expand Menu/*.man since no file matched.

Go to $HOME/.fvwm and type in:

ls 'Menu/*.man'

I hope I'm explaining this right, its getting late.

---

From: Cameron Simpson <[email-masked]>
Date: Wed, 20 Nov 2002 18:34:24 +1100

On 00:42 20 Nov 2002, Dan Espen <[email-masked]> wrote:
| Norvell Spearman <[email-masked]> writes:
| > On Tue, Nov 19, 2002 at 11:30:45PM -0500, Dan Espen wrote:
| > > Norvell Spearman <[email-masked]> writes:
| > > > fvwm-2.5.4
| > > > I have the following line in a configuration file
| > > > PipeRead 'for i in Menu/*.men; do echo read $i; done'
[...]
| > [FVWM][Read]: <<ERROR>> file 'Menu/*.men' not found in \
| > /home/norvell/.fvwm or /usr/share/fvwm
| 
| You still see the "*" in the file name because the shell didn't
| expand Menu/*.man since no file matched.  [...]
| I hope I'm explaining this right, its getting late.

Sound right to me. Assuming the code is actually running where he hopes
(i.e. $HOME is fine), the above line  might be modified thus:

	PipeRead 'for i in Menu/*.men; do [ -f $i ] && echo read $i; done'

or just thus:

	PipeRead 'ls -d Menu/*.men 2>/dev/null | sed "s/^/read /"'

Your call as to which is easier to read :-)

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

You can fool too many of the people too much of the time. - James Thurber