Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Starting shell command in the same environment

Status
Not open for further replies.

grofaty

IS-IT--Management
Jan 16, 2003
370
SI
Hi,
I have installed FreeBasic compiler for Linux from web page.

I would like to execute shell commands. For example my bas file looks like this:

====
'Find if you are connected to database
SHELL "db2 connect to test_database"
'etc...
'Execute select statement
SHELL "db2 select * from mytable"
etc...
====

What I have found out is every SHELL command is executing itself in new shell process. So the second command fails, because it is executed in new "window" (process). Is there any way to invoke shell script in the same process terminal?

Thanks,
Grofaty
 
Hi,
I have tested even simpler test.

In Terminal I have set environment variable by command:
x="xxx"

To see the result I executed:
echo $x
And output is:
xxx

But compiling bas file command:
shell "echo $x" returns nothing. I think this is due to 'shell' command starts new environment. How to execute 'shell' commands in the current environment?

Thanks,
Grofaty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top