Bash/shell script to run C console application on multiple unix/linux terminals

I have a multi-process C program for unix systems. I want to write a shell/bash script to run the C program mentioned above on multiple terminals (one for each execution of the program). That is: the script should run different terminals and execute the program on each terminal. I have written this script, but it gives me a strange error on execution of support.sh, and the system is restarted. Can you help me?

/************************* Station.sh*****************************/

#!/bin/bash
type x-terminal-emulator >/dev/null 2>&1 && {
x-terminal-emulator -e ./support.sh ./Station 2304 2305 127.0.0.1 S
x-terminal-emulator -e ./support.sh ./Station 2305 2306 127.0.0.1 S
x-terminal-emulator -e ./support.sh ./Station 2306 2307 127.0.0.1 S
x-terminal-emulator -e ./support.sh ./Station 2307 2304 127.0.0.1 S
}

type x-terminal-emulator >/dev/null 2>&1 ||{
type gnome-terminal >/dev/null 2>&1 && {
gnome-terminal -x bash -c "./support.sh ./Station 2304 2305 127.0.0.1 S"
gnome-terminal -x bash -c "./support.sh ./Station 2305 2306 127.0.0.1 S"
gnome-terminal -x bash -c "./support.sh ./Station 2306 2307 127.0.0.1 S"
gnome-terminal -x bash -c "./support.sh ./Station 2307 2304 127.0.0.1 S"
}
}

type x-terminal-emulator >/dev/null 2>&1 || {
type gnome-terminal >/dev/null 2>&1 || {
type xterm >/dev/null 2>&1 && {
xterm -e ./support.sh ./Station 2304 2305 127.0.0.1 S &
xterm -e ./support.sh ./Station 2305 2306 127.0.0.1 S &
xterm -e ./support.sh ./Station 2306 2307 127.0.0.1 S &
xterm -e ./support.sh ./Station 2307 2304 127.0.0.1 S &
}
}
}

type x-terminal-emulator >/dev/null 2>&1 || {
type gnome-terminal >/dev/null 2>&1 || {
type xterm >/dev/null 2>&1 || echo "Nessun terminale conosciuto disponibile"
}
}


/*************************** support.sh************************/
#!/bin/bash
"$@"
exec "$SHELL"
链接地址: http://www.djcxy.com/p/25712.html

上一篇: 哪种MySQL数据类型用于存储布尔值

下一篇: Bash / shell脚本在多个unix / linux终端上运行C控制台应用程序