Re: typeset -p on an empty integer variable is an error. (plus -v test w
From:
Chet Ramey
Subject:
Re: typeset -p on an empty integer variable is an error. (plus -v test w/ array elements)
Date:
Sat, 12 Jan 2013 18:04:00 -0500
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/17.0 Thunderbird/17.0
On 1/12/13 10:07 AM, John Kearney wrote:
> regarding -e it mainly has a bad name because there is no good guide how
> to program with it.
> so for example this causes stress
> [ ! -d ${dirname} ] && mkdir ${dirname}
> because if the dir exists it will exit the scripts :)
I'm not sure this is what you wanted to say. When -e is set, that code
will not cause an error exit if ${dirname} exists and is a directory. Run
this script in the bash source directory and see what happens:
set -e
[ ! -d builtins ] && mkdir builtins
echo after
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/