0

このスクリプトを実行すると、端末が開いてすぐに閉じているため、結果が表示されません。

私が知っていることは何も役に立ちません。

私はSunOS5.9を使用していますが、それは私のせいではありません))

#!/bin/bash

if [ -z "$1" ]; then 
echo "enter command"
fi

if [ -z "$2" ]; then 
echo "enter command"
fi

if [ -z "$3" ]; then 
echo "enter command"
fi

xterm -e $1 | wait & 

xterm -e $2 | wait & 

xterm -e $3 | wait & 
4

2 に答える 2

0

コマンドが失敗した場合でもコマンドが生成したものを確認したい場合は、コマンドを次のように置き換えます。

xterm -xrm '*hold: true' -e $1 &   # this is to keep xterm from closing
pid1=$!  # this is to save the pid, in case you want to close it
disown   # this is to prevent the finishing shell from closing the xterm

あるいは、がオプションxtermをサポートしていない場合:-xrm

CMD="$1" xterm -e $SHELL -c '$SHELL -c "$CMD"; read'

2 つのシェルは、コマンドの構文エラーから保護し、この場合でも xterm を開いたままにします。

于 2012-07-26T12:09:09.780 に答える