Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
HI ,
In the below script I am trying to return the value of the environment variable TIBCO_HOME to the caller
#! /usr/bin/csh
set VAR_NAME=$1
echo VAR_NAME
On the aix console.. set to setenv TIBCO_HOME /app/tibco
When I execute the script… myscript.sh TIBCO_HOME, the script prints TIBCO_HOME. But I am expecting /app/tibco.
Can anyone help me to fix this?
Thanks,Babu

HI,
Thanks for your response.
I changed my script but still the script prints TIBCO_HOME.I am invoking the script as "csh -f test1.sh TIBCO_HOME"
echo $TIBCO_HOME on unix console returns /app/tibco, I want the same output from my script.
Below is the modified script..
#! /usr/bin/csh
set VAR_NAME=$1
echo $VAR_NAMEThanks,
bce

First, there is no reason for you to do this:
csh -f test1.sh TIBCO_HOME
Since you are invoking csh in your script with #!/usr/bin/csh there is no reason to spawn the extra shell. This will do the job just as well:
test1.sh TIBCO_HOME
Second, if you are trying to pass argument 1, and then echo that as an environmental variable, then this should work. If TIBCO_HOME isn't defined, the script will error out:
#! /usr/bin/csh # this script, test1.sh, takes one argument, TIBCO_HOME in this case: # test1.sh TIBCO_NAME # then, echo out the shell environmental variable TIBCO_HOME eval echo \"\$${1}\"

Babu,
See the below script, i hope it will clear your doubts
#!/usr/bin/csh
#Get the env variable valuesset JP=$1
echo $JP # user given input values
echo $JAVA_BINDIR # Env variableRun:
$ ./env_val.csh TestinputOutput:
Testinput
/usr/lib/java/jre/binNote:
if you want change the env file variable and values after that you have to source the env files. then only it will affect the env file.for sourcing the env file:
$ . . env
Thanks

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |