I would like to run two commands in my script. The fist runs a test and the second queries this test to obtain a test id.
Now, the problem is that the second command works ONLY WHILE the first command is running (and of course, after it started). So i can’t run it sequentially.
As far as i can understand, i need some sort of parallelism, which should allow the 2 processes to run in parallel. This would allow the second command to obtain the ID from the first, as it is still running.
Point is: i don’t have and i can’t install Parallel on this machine. I saw also xargs, but doesn’t seem to suite for this task.
Any ideas?
The command looks something like this:
run test | list test running
Thanks
Edit
This is how the report looks like. It has many different parameters but the first one is the one i need.
ID | 94503
Name | Test
...
To grab the ID i use:
sed -n '1p' | sed 's/^.\{,17\}//' > test_id.dat
Which give me back the ID number.
Piping won’t work. The point is that after run test
, the problem in fact is that when I start the test, the “shell remains busy” with the test execution. The second command, on the other hand, can retrieve this ID only while the test is running. Example: if I start the test from two separate sessions (one local, one ssh) I can get the expected result.
Edit 2
Some additional details. In order to obtain the “test id”, i’ve to run a commnad which lists all current running tests (list test running
).
I follow the advices and wrote something like this:
#!/bin/bash
list test running > test_running.dat | {
run test
cat test_running.dat | sed -n '1p' | sed 's/^.\{,17\}//' > test_id.dat
cat test_id.dat
}
The problem here (no matter which command i put first) is that i get as result in the file “No test running”. Meaning that the list test running
gets executed to early or to late, but in any case not WHILE run test
is running.