I'm a newbie of Shell Script Linux.
I'm working on Automation testing with Android , so I'd like to run some shell script following as bellow:
Unfortunately , when I run cmd1.sh I MUST wait 3 minute before cmd2.sh is run.
That means I can not record a video :sad:
Here is the my run command content:
run.sh file content:
./cmd1.sh $
./cmd2.sh
cmd1.sh file content:
adb shell screenrecord /sdcard/file.mp4
cmd2.sh file content:
calabash-android run app.apk
Finally, I open terminal then run command :
./run.sh
Of course, video can not save because after cmd1.sh is finished, cmd2.sh is run !!!
Have anybody can help me in this point?
Thank you so much !
@Jrican Updated
Here is the manual step that I can play video recording.
1. OPEN terminal A
2. Run command 1 ( Start recording screen script )
3. Open other terminal B then run a command 2
4. After command 2 finished, go back to Terminal A then Ctrl C .
5. Confirm video in /sdcard/file.mp4 that can play normally
I'm working on MAC OSX Yosemite 10.10.5
Easy Solution: run.sh file content:
./cmd1.sh & # run this command in the background
./cmd2.sh # run this command to completion
kill -SIGINT %1 # send the interrupt signal to the first command (ctrl+c)
Slightly more correct Solution: run.sh file content:
./cmd1.sh & # run this command in the background
recPID=$! # save the PID for this process for later
./cmd2.sh # run this command to completion
kill -SIGINT $recPID # send the interrupt signal to the first command (ctrl+c)