Re: Redirect output to x-window in linux?
On 2006-08-24, Dave Farrance wrote:
> Is it possible for a bash script to test it it's not running in a
> terminal and if that's the case, pop open an x-window of some sort (in
> linux) and redirect the output of the remaining commands in that script
> to the x-window?
>
> The test is easy enough: [ "$TERM" == "dumb" ]
>
> ...but I can't figure out how to redirect the output of the remaining
> script commands to an x-window.
[ -t 0 ] || { xterm -e "$0" "$@"; exit; }
printf "%s " "${*:-Enter name: }"
read name
--
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
|