user1960932
user1960932

Reputation:

How to call the shell script from another shell script?

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 &

Upvotes: 0

Views: 111

Answers (1)

kmkaplan
kmkaplan

Reputation: 18960

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

Upvotes: 3

Related Questions