Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 502775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:19:33+00:00 2026-05-13T06:19:33+00:00

I have a Bash script that basically initializes an application and sets parameters. One

  • 0

I have a Bash script that basically initializes an application and sets parameters. One of these parameters is the location to OpenOffice. Now OpenOffice doesn’t set an environment variable when you install it.

What is the best method of finding the location of an application installed and caching that information so you don’t have to do the I/O next time?

What I was thinking was simply running a find on /usr/ for the OpenOffice directory which has a specific file. When it’s found store that directory in a environment variable and in this script check if the environment variable is set and is a directory, if so use it, if not search again.

This would allow the script to work without user interaction but also allow the user to set a path themselves (since it’s an environment variable).

This seems like a “bad practice”, so I’m hoping maybe someone else can give me the common way of getting information about a software install. If it helps, OpenOffice will most likely be installed using aptitude.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:19:34+00:00Added an answer on May 13, 2026 at 6:19 am

    The way I’ve usually seen it done is with some code like this:

    [ -z "$OO_EXE" ] && OO_EXE=/usr/bin/oo # or whatever the executable is called
    

    Then you can always assume that the OO_EXE environment variable is set later on in the script. The user can override the default by setting OO_EXE in the environment before running the script, but if he doesn’t then the script falls back to the default.

    If you want to dynamically find the default the first time the script is run and reuse it every other time, then I would prompt the user for the path the first time the script is run, drop a dot file in the user’s home directory, and read from that file every other time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 325k
  • Answers 325k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer select top 1 t.Id, SUM(r.Rating) as Rating, MAX(Datetime) as LastPlayed… May 14, 2026 at 1:24 am
  • Editorial Team
    Editorial Team added an answer This article http://www.lostechies.com/blogs/chad_myers/archive/2009/04/27/to-mvc-or-to-webforms.aspx has good arguments why you would want… May 14, 2026 at 1:24 am
  • Editorial Team
    Editorial Team added an answer I'd use IllegalArgumentException if the parameter/argument is controlled from outside,… May 14, 2026 at 1:24 am

Related Questions

this is a bit related to this question . I'm using make to extract
can best help me systematically modify the replace field of a regex search as
I have this bash script on the server that runs every hour, via cron.
I have a small lightweight application that is used as part of a larger
Basically I am wondering if it is possible to run a console script (.sh)

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.