| View previous topic :: View next topic |
| Author |
Message |
leke LXF regular

Joined: Mon Oct 22, 2007 6:45 pm Posts: 479 Location: Oulu, Finland
|
Posted: Wed May 26, 2010 8:51 pm Post subject: Continue execution of bash script while in listening state |
|
|
I wanted to automate a fairly long shell script process that kind of falls in to a listening state and then would need to open another window and execute another command. Problem is, I don't know how to run other commands after that state is reached.
Any tips?
Thanks.
Here is the script if you are interested...
| Code: |
hciconfig reset
sdptool add --channel=2 SP
# Connect phone's bluetooth console to PC then...
rfcomm listen rfcomm2 2
# Connection is made. Process is ongoing.
# This would open new terminal if the last command wasn't still running.
gnome-terminal -e 'cu -l /dev/rfcomm2' |
_________________ I codes here: http://notsure.tk |
|
| Back to top |
|
 |
nelz Moderator

Joined: Mon Apr 04, 2005 12:52 pm Posts: 8002 Location: Warrington, UK
|
Posted: Wed May 26, 2010 9:07 pm Post subject: |
|
|
You could use a fifo, which works rather like a pipe but looks like a file. Something like
| Code: |
mkfifo /tmp/myfifo
command1 >/tmp/myfifo &
cat /tmp/myfifo | while read stuff; do
process stuff
done
|
The & on command1 backgrounds the process. Then your loop runs until command1 exits and it has read all data in the pipe. _________________ Unix is user-friendly. It's just very selective about who it's friends are. |
|
| Back to top |
|
 |
leke LXF regular

Joined: Mon Oct 22, 2007 6:45 pm Posts: 479 Location: Oulu, Finland
|
Posted: Fri May 28, 2010 1:04 pm Post subject: |
|
|
Thanks. I've still trying to understand how it works, but thanks for the info I'll do some googling on the subject  _________________ I codes here: http://notsure.tk |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|