Subject: Re: Determine session type?
To: Jan Danielsson <jan.m.danielsson@gmail.com>
From: Chavdar Ivanov <ci4ic4@gmail.com>
List: netbsd-help
Date: 11/30/2006 16:29:09
On 11/30/06, Jan Danielsson <jan.m.danielsson@gmail.com> wrote:
> Hello,
>
>    I have a script which I use to edit encrypted files. It simply
> decrypts the file onto /tmp/, starts "vi" against the decrypted file,
> then - when I quit the editor - it encrypts the file again.
>
>    But I'd like it to start "nedit" instead *if* I'm running under X. I
> assume this is possible? If so -- how?

Shamelessly modified gftp script:

#!/bin/sh

prefix=/usr/pkg
exec_prefix=${prefix}

if [ "$DISPLAY " != " " ] && [ -f ${exec_prefix}/bin/nedit ]; then
        exec ${exec_prefix}/bin/nedit ${1+"$@"}
else
        exec /usr/bin/vi ${1+"$@"}
fi

>
> --
> Kind regards,
> Jan Danielsson
>
>
>
>
>

Chavdar