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

我有一个针对unix系统的多进程C程序。 我想编写一个shell / bash脚本来在多个终端上运行上面提到的C程序(程序的每次执行一个)。 即:脚本应运行不同的终端并在每个终端上执行程序。 我写了这个脚本,但是它在执行support.sh时给了我一个奇怪的错误,并且系统重新启动。 你可以帮我吗?

/************************* 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/25711.html

上一篇: Bash/shell script to run C console application on multiple unix/linux terminals

下一篇: Using the RUN instruction in a Dockerfile with 'source' does not work