^thehatsrule^
Group: Members
Posts: 3275
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:
Quote | I read somewhere that some versions of bash can only use -z with number variables.
Try:
if [ ! -n "$MEMINFO" ]
aka not not null. | 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.
|