using subshell in another xterm
Hi there guys, problem is simple, i want to run some parts of a script in different terminals. I already found about subshell, () using parenthesis to group commands and using xterm -e (function), problem is i can not get pid for the function running in the other terminal. And if I use & to set the job in background the terminal goes away as soon as it ends the job.
I am using log files, and then send it them using built in mail. After all the parts finish i have to run the "main" script which needs the data from all the pieces. Also other question, i usually use bash, but to load a tool i need csh, the tool is not mine so i can not change the csh usage. There is anyway of passing bash scripts/commands at the moment of changing/invoking to csh shell in the same console? |
(csh commands-or-file-name) or simply having bash run a csh script which has the /bin/csh shebang.
|
Please post the commands you already have used.
|
trying to run commands in xterm
Code:
#!/bin/bash then it will start printing in the console, but if you try as I posted the xterm opens and closes, with out printing anything. |
I think you've prompted me to learn something...
If you run your script in a shell, it works as expected; an endless stream of messages. However, if you run it in a subshell: Code:
bash sube --- rod. |
Yep kind of complicated, and i still have not figure out, how to make it run :(, any ideas ?
Quote:
|
Functions can't be used as external binaries and they are also rarely inherited. Why not just create another script named sube?
|
Actually, you can export a function so that it is available to scripts which your script executes.
Code:
#!/bin/bash |
@gnashley so some shells also export functions in the same delivery method just like like environmental variables.. i never thought about that. I always think functions can only be transported inside the same shellspace, for example, subshells called using ().
|
did not know about that either
Thanks a bunch @gnashley
I'll try it right away :) |
it aborts...
Did you run this script, i get an error when i try to run it...
Quote:
|
Yes, I did run it and it works fine here. What is the exact error you are getting?
|
Quote:
Look like it does not import the function. I just copy 'n' paste the code, but i still got the error above. |
"Distribution: Debian-Sarge" What is your shell? dash, maybe?
|
It's my understanding that, depending on the shell, functions should be declared either by the syntax name() {..}, or by function name {..}. Mixing the two, function name() {..}, is not good syntax, although bash at least allows it.
My system is set so that dash is used to run posix scripts, and when I used #!/bin/sh in a quick test script just now, it would only accept the name() {..} form. |
All times are GMT -5. The time now is 05:55 AM. |