0

I have written 2 scripts which opens the vncviewer of 2 hosts.and i have another 1 script that calls both the scripts.but when I call the main script the 1st vncviewer opens and after closing the window, the 2nd vncviewer is opening..but I want to run both scripts simultaneously..how to do this?

Here are the scripts involved:

22.sh

#!/bin/sh 
# 
host='192.168.2.22' 
vncviewer $host --viewonly 

25.sh

#!/bin/sh 
# 
host='192.168.2.25' 
vncviewer $host --viewonly 

main script that calls 2 scripts

#!/bin/sh 
# 
./22.sh 
./25.sh 
sh -x 22.sh & 
sh -x 25.sh &

1 Answer 1

3

You need to background the first invocation of vncviewer. Use & after the command for this.

Sign up to request clarification or add additional context in comments.

4 Comments

yes i did that.but it is running and not going to 2nd script until 1st window is closed.
@chandan it would be better if you showed us the two scripts.
22.sh #!/bin/sh # host='192.168.2.22' vncviewer $host --viewonly 25.sh #!/bin/sh # host='192.168.2.25' vncviewer $host --viewonly main script that calls 2 scripts #!/bin/sh # ./22.sh ./25.sh sh -x 22.sh & sh -x 25.sh &
@chandan I integrated these scripts in your question but I am not sure my rendering of the main script corresponds to reality - please check and edit if needed!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.