be better at checking strings which aere mainly empty

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2016-04-12 15:38:12 +01:00
parent 0390b2ba4d
commit aaebcf5866

View File

@ -38,8 +38,10 @@ KEY=$(echo $2 | sed 's@^/@@')
if [ $1 == "exists" ]
then
[ -d ${BASE}/${KEY} ] && exit 0
[ -f ${BASE}/${KEY} -a ! -z "$(cat ${BASE}/${KEY})" ] && exit 0
exit 1
[ -f ${BASE}/${KEY} ] || exit 1
VALUE="$(cat ${BASE}/${KEY} | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
[ -z "${VALUE}" ] && exit 1
exit 0
fi
if [ $1 == "dir" ]