Mark Finlay said on Thu, Jun 06, 2002 at 04:14:58PM +0100:
> I'm writing an addon to OpenOffice.org and I need to be able to autodetect where on the system
> the use has installed OpenOffice.org. So far I've got the following bash script:
>> echo "Where is the man OpenOffice Install"
> read location
> echo "" >> /etc/profile
> echo "export PATH=\"\$PATH:$location/program\" " >> /etc/profile
> echo "export EOFFICE=\"$location\" " >> /etc/profile
>> That lets me use the oo location in my scripts but I'd prefer to autodetect
> the program location. OpenOffice puts the .sversionrc file in the users home directory
> containing the following text:
>>> [Versions]
> OpenOffice.org 1.0=file:///home/sisob/OpenOffice.org1.0>>>> I need to suck out the location, in this case /home/sisob/OpenOffice.org1.0
> to use in the bash script. Anyone want to right me a scriptlet in perl of bash
> or something standard like that. Go on: show us all how leet a coder you are.
>#!/usr/bin/perl
my ($line,$location) = undef;
open(SVERSION, $ENV{'HOME'} . "/.sversionrc") or die "Cannot open
~/.sversionrc";
while ($line = <SVERSION>)
{
if ($line =~ /^OpenOffice.+?file:\/\/(.+?)$/)
{
$location = $1;
}
}
close (SVERSION);
print "export EOFFICE=" . $location . "\n";
- DoC
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!