Bug 3943

Summary: error in testing file of existence
Product: Busybox Reporter: mbr
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED INVALID    
Severity: critical CC: busybox-cvs
Priority: P5    
Version: 1.18.x   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Host: Target:
Build:

Description mbr 2011-07-01 10:35:26 UTC
The following script fails:

#!/bin/ash

FILE=

if [[ -e ${FILE} ]]
then
	echo "found file: \`${FILE}'"
else
	echo "did not found file: \`${FILE}'"
fi

The test is always true!! So it says: found file `'
Comment 1 Denys Vlasenko 2011-07-02 23:17:57 UTC
Not a bug: bash and coreutils do the same.

You should use

if [[ -e "${FILE}" ]]

instead.