Beta What <
lite.o...@gmail.com> wrote:
> Hi,
>
> Does the shell (bash and csh) treat set variable that are set to empty
> string "" same as unset variables. I believe csh requires variable to
> be set. For bash, are unset and "" the same in all contexts? If not
> can you point me to when they are not?
for tcsh (on many systems as csh) checking an unset
variable will result in this message:
z: Undefined variable.
where $z is the variable name. I believe this is the same
as the original csh, I can check tomorrow at work and will
reply if different.
You can check for a variable existance by:
if ($?z) then
...
endif
>
> How about unset variable in operations, like arithmetic or tests?
> From some tests it seems like bash treats unset variables as =0.
unset in tcsh will remove the variable and you will start
seeing the message above.
John