Reputation: 171
I have to run another terminal within script and wait for function to execute on that terminal before proceeding next command in shell script. Scenario is as like below
script.sh
!/bin/sh
...
...
gnome-terminal --working-directory=#{image_path} -e ./test.sh # execute test.sh script on another terminal
./switch 0 0 # I have to execute this command after test.sh script gets completed on another terminal
...
...
Here problem is. test.sh script is not gets executed fully and returned back immediately to parent script and executes ./switch 0 0
command. As this ./switch 0 0
command depends on test.sh
script completion, my script gets failed.
Regards Manish B.
Upvotes: 0
Views: 69
Reputation: 75458
I'm not sure if there's a switch in gnome-terminal that can make it run synchronously, but you can use xterm for that. Xterm won't go to the background unlike other terminals:
( D=$(pwd); cd "$image_path"; xterm -e "$D/test.sh" )
./switch 0 0
Upvotes: 1