Joined: July 2006
||Posted: Jan. 30 2008,17:23
I think that's because $() uses a subshell in order to execute the command substitution... so the variable is lost afterwards.
Since you really only need to read that file once, the easiest change would be to read it before you call that function.
EDIT: saw previous post:
You mean for test, not bash..? Also, -z is for strings only (and if it wasn't, an error would be printed). For the most portability, = should be used iirc.
|I read somewhere that some versions of bash can only use -z with number variables.|
if [ ! -n "$MEMINFO" ]
aka not not null.