Hi,

I wanted to write a script which display different prompt for session
made through SSH. SSH should set SSH_CLIENT and SSH_TTY variables, so it
should be easy to check. Unfortunately I am unable to write working if
for those two cases. In the end it seem that even simple test with “-n”
from manual (there with $MANPAGE) doesn’t work for me. Following function:

|function ntest
    if test -n $NOT_SET_VARIABLE
        echo "Non-zero"
        echo $NOT_SET_VARIABLE
    else
        echo "Zero length"
    end
end
|

returns:

|Non-zero
<empty line>
|

Of course variable is not set:

|$ echo $NOT_SET_VARIABLE
<empty line>
|

What is wrong in that code? How can I check if a variable is set?

Fish 2.1.1, Fedora 21.

Marcin

​
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to