running variable on command line

Hi,

I have a unix script, and I have problem, where I work out the variable I need. But it will not excute the variable from the script ?

See my script below for details :

#!/bin/sh
 
ENVGRP=`hostname |cut -c1-3 |  tr '[a-z]' '[A-Z]'`
ENVINST=${ENVGRP}`hostname -i |cut -d\. -f 4`
 
echo $ENVINST
 
$ENVINST
 

Running the script :

[dev@dev08systemrel scripts] :$ ./ReleaseManagement.sh
++ hostname
++ cut -c1-3
++ tr '[a-z]' '[A-Z]'
+ ENVGRP=DEV
++ hostname -i
++ cut -d. -f 4
+ ENVINST=DEV6
+ echo DEV6
DEV6
+ DEV6
./ReleaseManagement.sh: line 9: : command not found
[dev@systemrel scripts] :$

Not sure what I doing wrong here, please could someone advise.
thank you

what are you trying to do with that last line .. $ENVINST ..

How do you usually call the DEV6 script?

when I login into the environment, I just type DEV6 on the command line and this sources the environment variables.

Now I would like to excute DEV6 within a start of a script. SO if you logged into the environment first time round and you forgot to type DEV6 on the command line, the script would take care of this.

You will have to set the environment in this script, not in a script called from this one.

Does your script have the expected environment (PATH, etc.) at all? If it is called from cron then the envronment is guaranteed to be radically different from your login environment.

Second: it seems that "DEV6" is starting all right, but *it* encounters an error, not the script you showed us. What the error in a script we do not know is is hard to guess, my crystal sphere is undergoing maintenance right now.

Post the script and we might find problems with it, otherwise you will have to search and debug for yourself.

I hope this helps.

bakunin