# test Null variable

**URL:** <https://community.unix.com/t/test-null-variable/167122>\
**Category:** Shell Programming and Scripting\
**Created:** [November 24, 2006, 9:25am UTC](https://community.unix.com/t/test-null-variable/167122 "2006-11-24T09:25:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kykyboss](https://community.unix.com/letter_avatar/kykyboss/32/5_5575768a8748004e209b776fc1b2916d.png) [@kykyboss](https://community.unix.com/u/kykyboss)\
**Post date:** [November 24, 2006, 9:25am UTC](https://community.unix.com/t/test-null-variable/167122/1 "2006-11-24T09:25:24Z")

</div>

hi forum

i beginning with script and i want test un null variable in a schell  
i just don t know the syntax here is a litle example

y=test  
echo $y  
unset y  
echo $y (so here Y = Null)

if Y=Null

then  
echo "y is null"  
exit  
fi

i have try  
if [!$y]  
but i have the error  
test: argument expected

---

<div class="post-metadata">

**Author:** ![kykyboss](https://community.unix.com/letter_avatar/kykyboss/32/5_5575768a8748004e209b776fc1b2916d.png) [@kykyboss](https://community.unix.com/u/kykyboss)\
**Post date:** [November 24, 2006, 11:02am UTC](https://community.unix.com/t/test-null-variable/167122/2 "2006-11-24T11:02:27Z")

</div>

i found it myself thank

if [-z "$y"]
