Sponsored Content
Top Forums Shell Programming and Scripting Shell Script for Setting Env Variables Post 302886370 by PavanPatil on Friday 31st of January 2014 02:30:01 AM
Old 01-31-2014
Shell Script for Setting Env Variables

Hello All.

Good Afternoon.

I need one small help regarding setting of env variables for a particular host by getting it from the DB.

For ex :

1. I am using LOCALHOST.
2. When I run a ./hostset.sh it should pick up the Oracle home details from associated DB and set it.

Please let me know is it a possible one. I am new this UNIX and I went through some of the links but not quite understanding the concept.

Thank you all for your help in advance.

Regards,
Pavan
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Setting up shell variables

Hi everyone, I am trying to set up the .profile for a user I have just created. In trying to set up the shell variables, I want to make the shell be korn shell (default shell i believe is Borne shell), so, this is what I did: SHELL=/usr/bin/ksh export SHELL Whenl executing the .profile,... (1 Reply)
Discussion started by: rachael
1 Replies

2. Shell Programming and Scripting

Some env setting is causing the script not to work ?

Not sure what has changed in the Unix environment. The following script which was working is now not working. #!/usr/bin/ksh # ----------------------------------------------------------------------------- # File: monitor_db.sh # #... (1 Reply)
Discussion started by: uuser
1 Replies

3. Programming

including shell env variables into C code

Hey, I'm brushing up on C code and I'm trying to incorporate the shell environmental variables into standard ansi C code. For example I just want to do the equivalent of --echo $PATH-- and implement that in standard ansi C code. How would I do that? Thanks (4 Replies)
Discussion started by: bdsffl
4 Replies

4. UNIX for Advanced & Expert Users

How to export ENV variables, which remains set for all the shell

Hi ! How to export ENV variables, which remains set for all the shell Example :- Login :myID Pwd : **** -> Here my ID .profile is executed. Let say I set MYENV variable Kisses% rlogin ABC -l XXXGroupID -> I login into a remote Solaris Server ABC password : **** -> "XXXGroupID's... (1 Reply)
Discussion started by: dashok.83
1 Replies

5. UNIX for Dummies Questions & Answers

Setting env variables using script

Hi, I wrote two small scripts to set env variables in a shell. java_env.csh #!/bin/csh -fn setenv JAVA_HOME '/scratch/software/jdk1.5.0_11' setenv PATH $PATH':'$JAVA_HOME'/bin' and run it using csh ./java_env.csh But the env variables are not set. I tried running each line on the... (5 Replies)
Discussion started by: NoviceAmod
5 Replies

6. Shell Programming and Scripting

Setting Variables WITHIN For Loop in DOS Command Shell

I'm wondering if any of you could lend an assist with a small problem. First, I'm under the impression I need to use Delayed Environment Variable Expansion (DEVE), based on other things I've read across the web. Summary: trying to use command shell (cmd.exe) in XP sp3 (if that's relevant) to... (4 Replies)
Discussion started by: ProGrammar
4 Replies

7. Shell Programming and Scripting

Issue with a Unix script Env setting

Hi, I have the below script #------------------------------------------------------------------------------ #Set up environment variables #------------------------------------------------------------------------------ SCRIPTS_DIR=/remedy/scripts/ServerVolumeBilling... (3 Replies)
Discussion started by: anilvaranasi_02
3 Replies

8. Shell Programming and Scripting

tcsh env setting using shell script

Hi All, I have made a file file usercreate.sh & it has to run in tcsh env & needs some path to be set. my script is as below. ########################## #!/bin/csh setenv PATH "/usr/lib/java/class" setenv LD_LIBRARAY_PATH ########################### but when i am ruuning my script... (1 Reply)
Discussion started by: ajaincv
1 Replies

9. Shell Programming and Scripting

Env variables in script

Hi All, I have script and it's hardcoded the script ca invoke in user home dir and logs will be redirected to home dir of user. how to make the same script will be invoke from /usr/bin with out chg the logs and other functions path from /user/homedir . code is below: pls check how to... (1 Reply)
Discussion started by: saku
1 Replies

10. Shell Programming and Scripting

Setting ENV variables in PERL

I have perl script and in the first line we are invoking .sh script to set ENV variables. e..g eval '. $envfile; exec $PERL -S $0 "$@"' I want to change some of the env variables while the program is running and I am settging it like this .. $ENV{ORACLE_HOME}=trim($oraclehome);... (1 Reply)
Discussion started by: talashil
1 Replies
env(1)							      General Commands Manual							    env(1)

NAME
env, printenv - Displays or sets the current environment, or displays the values of environment variables SYNOPSIS
Current Syntax env [-i] [name=value...] [command] [args...] printenv [name] Obsolescent Syntax env [-] [name=value...] [command] [args...] STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: env: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Invokes utility with exactly the environment specified by the arguments; the inherited environment is ignored completely. Changes are in effect only while the specified command is running. Dash is equivalent to -i option. OPERANDS
Changes in the form name=value are added to the current environment before the command is run. [Tru64 UNIX] Name of an environment vari- able to be printed. Name of a command to be invoked with the modified environment. Arguments to be passed to command when it is executed. DESCRIPTION
The env command lets you get and change your current environment, and then run the specified command with the changed environment. If the -i option is used, the current environment is ignored and the command runs with only the changed environment. Changes are only in effect while the specified command is running. If command is not specified, env displays your current environment, one name=value pair per line. [Tru64 UNIX] The printenv command displays the values of the variables in the environment. If name is specified, only its value is printed. If name is not the name of a currently set environment variable, only a blank line is printed, no error is reported. If name is not specified, printenv displays the current environment, one name=value per line. EXIT STATUS
If command is invoked, the exit status of env is the exit status of command; otherwise, the env utility exits with one of the following values: The env utility completed successfully. An error occurred in the env utility. The command specified by command was found but could not be invoked. The command specified by command could not be found. EXAMPLES
To add a shell variable to the environment for the duration of one command (sh only), enter: TZ=MST7MDT date env TZ=MST7MDT date Each of these commands displays the current date and time in Mountain Standard Time. The two commands shown are equivalent. When date is finished, the previous value of TZ takes effect again. To replace the environment with another one, enter: env -i PATH=$PATH IDIR=/u/jim/include LIBDIR=/u/jim/lib make This runs make in an environment that consists only of these definitions for PATH, IDIR, and LIBDIR. You must redefine PATH so that the shell can find the make command. When make is finished, the previous environment takes effect again. To find the current setting of the TERM environment variable, enter: printenv TERM The command returns the value for the TERM environment variable. ENVIRONMENT VARIABLES
The following environment variables affect the execution of env: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the for- mat and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: csh(1), ksh(1), Bourne shell sh(1b), POSIX shell sh(1p) Functions: exec(2) Standards: standards(5) env(1)
All times are GMT -4. The time now is 08:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy