On Mon, Mar 12, 2001, Ben-Nes Michael wrote about "Re: bash prop":
> # to get the client connectewd from ( get $1 as IP)
> set $SSH_CLIENT
> 
> # to bind X DISPLAY to the remote host
> export DISPLAY=$1:0.0

just a small security note:
Your use of set here is quite dangerous, because $SSH_CLIENT may contain
paramters to set! For example, if SSH_CLIENT is "-n", this script will not
do anything after the set command - and if you put it in your ~/.profile
or something, you'll not be able to do anything with the shell :)

the solution recommended since antiquity (e.g., Kernighan & Pike's "The
Unix Programming Environment", 1984) is to do something like

        set x $SSH_CLIENT
        export DISPLAY=$2:0.0

or even

        set x $SSH_CLIENT; shift
        export DISPLAY=$1:0.0

note that none of these forms work in zsh, which changed the way whitespace
is processed in commands ("$SSH_CLIENT" is treated as one word). The
modern method is to use "%%": (see manual of bash or zsh for more information)

        export DISPLAY=${SSH_CLIENT%% *}     # don't remove the space before *

-- 
Nadav Har'El                        |        Monday, Mar 12 2001, 17 Adar 5761
[EMAIL PROTECTED]             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |If Windows is the answer, you didn't
http://nadav.harel.org.il           |understand the question.

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to