简体   繁体   中英

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 &

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM