ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The script will probably not do that much, both gsub statements are incorrect.
It should be: gsub(/string/,replacement), not gsub("string",replacement).
What the maker probably tried to do is:
Get the content of environment variables called ORA_DB, ORA_APP, ORA_BASE and stores these in oracle_home and oracle_base (Strange: both ORA_DB and ORA_APP are stored in oracle_home, the second overriding the first, which is _probably_ incorrect/unwanted).
After this is done, all lines in $PRODUCT_DIR/osmf-http._env are checked for the existence of \$ORA_DB and/or \$ORA_BASE (the literal name, not the content) and substitute these with the content found in the environment variable.
I.e:
If ORA_DB holds /path/to/db, oracle_home is set to /path/to/db
If $PRODUCT_DIR/osmf-http._env has the following line: $ORA_DB/http/specific/db it will be changed to:
/path/to/db/http/specific/db
But like I stated before: The script isn't written correctly and will probably not work.
The script will probably not do that much, both gsub statements are incorrect.
It should be: gsub(/string/,replacement), not gsub("string",replacement).
More accurately, it is gsub(/regexp/,replacement), and there is nothing wrong with gsub("string",replacement):
Gnu awk is forgiving and using "..." instead of /.../ will probably have the same results. But...
Other awk flavors (awk/mawk/nawk to name just 3) are stricter/different and only work when using the correct syntax (as found in many awk documents/books).
It's always good practise to use syntactically correct commands, these will work in all flavors. All other extra 'stuff' is great, but will probably bind you to one specific flavor.
gsub(/regexp/,replacement) => works on gnu awk/awk/nawk (don't have mawk around, but it will probably work) and is in general syntactically correct.
gsub("string",replacement) => will work with gnu awk and (BSD)awk, will not work with nawk and (SUN) awk.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.