[SWLUG] Bash Export Question
SPUFI Doo
spufidoo at yahoo.co.uk
Thu Apr 24 10:40:47 UTC 2003
Hi,
I've a really simple question I can't get my newbie head around...
I have a bash script which signs me on to a database, and I would like it to export the database
name into a variable DATABASE.
#!/usr/bin/env bash
db2 attach to awdpss user db2admin using db2admin
db2 connect to misqwpdb user db2admin using db2admin
export DATABASE=`db2 get connection state | grep alias | awk -F"= " '{print $2}'`
export INSTANCE=`db2 attach | grep alias | awk -F" = " '{print $2}'`
If I run the command
export DATABASE=`db2 get connection state | grep alias | awk -F"= " '{print $2}'`
on the command line, echo $DATABASE returns the correct value, but if I include it at the end of
my bash script, echo $DATABASE returns nothing.
What am I doing wrong?
Marcus
(I'm no longer posting from my work address as I have no control over the automatic conversion to
HTML and the lobbing on of the ridiculous disclaimer)
__________________________________________________
Yahoo! Plus
For a better Internet experience
http://www.yahoo.co.uk/btoffer
More information about the Swlug
mailing list