Ryan Daly writes:
> AddToFunc "CreateStartMenu"
> + "I" DestroyMenu JizzBoneMenu
> + "I" PipeRead 'echo `/bin/hostname -s` > $HOME/.fvwm/.hostname'
> + "I" PipeRead 'echo "AddToMenu JizzBoneMenu `/bin/cat $HOME/.fvwm/.hostname` Title"'
> + "I" PipeRead '/bin/cat $HOME/.fvwm/.startmenu'
> + "I" /bin/rm $HOME/.fvwm/.hostname
This is such a big mess that I can't keep my mouth shut...
No offense, but I think someone should explain to you what you're
actually doing here.
Let's look at this line:
echo `/bin/hostname -s` > $HOME/.fvwm/.hostname
Hostname print's the host's name to stdout. The backticks around it
tell the shell to take hostname's stdout and substitute it where the
quoted command was. So, in the next step there's echo with one
argument, the name of the host. Echo takes it's arguments and prints
them to stdout. So, in your case, echo prints the host's name, which
is exactly the same as what /bin/hostname did in the first place.
This gets redirected into a temporary file, which is fine for the
moment. And the PipeRead makes sure that fvwm waits for the file to
be created.
Next line:
echo "AddToMenu JizzBoneMenu `/bin/cat $HOME/.fvwm/.hostname` Title"
Here you use cat to print the content of your temporary file to
stdout, which is then substituted into the echo ... line. The
temporary file contains nothing but the hostname, so this is now the
third time the hostname is printed to stdout. You can forget about
the temporary file completely if you just use /bin/hostname here.
By the way, on all systems I know (I just checked on SuSE, Redhat, and
Solaris), the hostname is in the environment variable HOST.
Next line:
+ "I" PipeRead '/bin/cat $HOME/.fvwm/.startmenu'
As far as I can tell, you simply want to read in the file
"$HOME/.fvwm/.startmenu". That's usually done with fvwm's Read
command, without invoking cat. There might be some other reason to
use PipeRead that I'm not aware of (e.g. $HOME).
So, I would try this:
AddToFunc "CreateStartMenu"
+ "I" DestroyMenu JizzBoneMenu
+ "I" PipeRead 'echo "AddToMenu JizzBoneMenu $HOST Title"'
+ "I" Read $HOME/.fvwm/.startmenu
That's two lines and 5 calls to external commands shorter.
Note that I didn't actually try it, since I don't want to mess around
with my fvwm-config right now...
Rainer
--
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 majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Wed Feb 18 2004 - 03:51:57 GMT