help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] test -v


From: Jesse Molina
Subject: Re: [Help-bash] test -v
Date: Sun, 29 Jan 2012 15:12:12 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:9.0.1) Gecko/20111221 Firefox/9.0.1 SeaMonkey/2.6.1


Thanks. My problem was that I was actually working on two hosts, one with bash 4.x and one with bash 3.x. I was reading the man page on the bash 4 host and trying to write and run the script on the bash 3 host. Obvious confusion ensued.



Pierre Gaston wrote:
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

--
# Jesse Molina
# Mail = address@hidden
# Page = address@hidden
# Cell = 1.602.323.7608
# Web  = http://www.opendreams.net/jesse/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]