Bash environment variables and finding installation directories -
I have a script which basically launches an application and sets the parameter one of these parameters The location is now when you install it, the OpenOffice does not set an environment variable.
What is the best way to install an application's location and caching that information, so you do not have to do I / O next time?
What I was thinking was searching on / usr / only for the OpenOffice directory, which contains a specific file when it stores the directory in an environment variable and is checked in this script If the environment variable is set and there is a directory, then if you use it, do not search again.
This script will allow the user to work without user interaction, but the user also allows him to set the path (since it is an environment variable).
It looks like a "bad practice," so I hope someone might give me general information about how to get information about setting up a software if it helps, then open Office will be installed using most of the possibility.
The way I usually see it is with some code like this:
[-z "$ OO_EXE"] & amp; Amp; OO_EXE = / usr / bin / oo # or whatever is called executable
then you can always assume that the OO_EXE
environment variable is set later in the script has been done . The user can override the default by setting OO_EXE
in the environment before running the script, but if he does not, the script returns to the default.
If you want to dynamically run the script for the first time and get it by default to reuse it every time, then I prompt the user for the first time to run the script , Drop the dot file into the user's home directory, and read from that file every other time.
Comments
Post a Comment