This is annoying - if anyone knows why this is happening, please tell me.
I'm only interested in the errno, not the error (which is not set with -p,
as stated in the docs).
For some reason, testing if $? = 0 is always false, even if $? really ought
to be true (ie. it's built all the directories and $ERROR = 0). Argh!
poo:
#!/bin/bash
echo "the errno is currently $?"
echo "making pants"
ERROR=$(mkdir -p pants/pants/pants/pants/pants/on 2>&1)
ERRNO=$?
if [ ! -z $? ]; then
echo "mkdir did not exit with 0"
echo "error: $ERROR"
echo "errno: $ERRNO"
fi
poo's output:
the errno is currently 0
making pants
mkdir did not exit with 0
error:
errno: 0
find pants:
pants
pants/pants
pants/pants/pants
pants/pants/pants/pants
pants/pants/pants/pants/pants
pants/pants/pants/pants/pants/on
- Jeff
--
http://www.xach.com/debian-users-are-beatniks.html
--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug