Hacker News new | ask | show | jobs
by gwu78 3347 days ago
Can an "empty" variable have a length greater than zero?

In Bourne once scripts I have been testing

   test ${#var} -gt 0 and

   test ${#var} -ge 1
In the past I have seen others use

   test x"" = x$var
1 comments

Yes, the test to see if "x" matches is the old school trick I was taught