Starting shell command in the same environment
Starting shell command in the same environment
(OP)
Hi,
I have installed FreeBasic compiler for Linux from http://www.freebasic.net/index.php/download 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
I have installed FreeBasic compiler for Linux from http://www.freebasic.net/index.php/download 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
RE: Starting shell command in the same environment
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