[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] test -v
From: |
Pierre Gaston |
Subject: |
Re: [Help-bash] test -v |
Date: |
Sun, 29 Jan 2012 18:14:47 +0200 |
On Sun, Jan 29, 2012 at 1:32 PM, Jesse Molina <address@hidden> wrote:
>
> Can someone cite an example of test -v which works? It is supposed to test
> if a variable has been defined, but I am confused.
>
> Normally I would [[ -z "$THINGY" ]] , but I thought I would give -v a shot.
> I get the feeling I should forget I ever tried.
unset var; [[ -v var ]] || echo false
var=;[[ -v var ]] && echo true
-z test if the expansion is empty which is a bit different from set or unset