Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Dec 2008 14:36:14 +0100
From:      Polytropon <freebsd@edvax.de>
To:        "Aggelidis Nikos" <aggelidis.news@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: open multiple xterms with script
Message-ID:  <20081203143614.bd0ef0cc.freebsd@edvax.de>
In-Reply-To: <30fc78250812022358v1970b4f6x6a1d6b3c9ca8f0c8@mail.gmail.com>
References:  <30fc78250812020007h22ab0dc4if044e46b4f36b00c@mail.gmail.com> <20081202093544.a5cb8a21.freebsd@edvax.de> <30fc78250812022358v1970b4f6x6a1d6b3c9ca8f0c8@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 3 Dec 2008 09:58:52 +0200, "Aggelidis Nikos" <aggelidis.news@gmail.=
com> wrote:
> some additional questions:
>=20
> 1) is there any way to give the root password once? i tried this:
> #!/bin/sh
>=20
> su root -c "\
> xterm -geometry 80x25 -title 'App 1' -e 'app1' &
> xterm -geometry 80x25 -title 'App 2' -e 'app2'\
> "
>=20
> but i get this:
> xterm Xt error: Can't open display: %s

Exactly. When you su root, $DISPLAY is not set, so you would have
to set it first, maybe like this:


	#!/bin/sh
	su root -c "\
		export DISPLAY=3D:0.0; \
		xterm -geometry 80x25 -title 'App 1' -e 'app1' &
		xterm -geometry 80x25 -title 'App 2' -e 'app2' \
	"



> 2)
> Is there any way to
> instruct xterm not to close after the execution of the program?

You could do this:

	xterm -geometry 80x25 -title 'App 1' -e 'app1 ; csh' &

which would start your prefered dialog shell when "app1" has
finished. The dialog shell would run even if "app" fails (that=C4s
why I suggest using ; instead of &&).



> So basically the idea is open 4 terminals, execute a specific command
> inside them but if the command finishes or stops, the terminal stays
> {with a new prompt}.

This sould be able to be achieved using the example above.


--=20
Polytropon
>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081203143614.bd0ef0cc.freebsd>