My bash script is not working properly, i don't know why
test.sh
#!/bin/bash
CLEAN_FILES=".slug-post-clean"
while read file; do
[[ ! -n "${file}" ]] && continue
echo $file
echo "if [[ -d ${file}]]; then exists ";
if [[ -d "${file}" ]]; then
echo "file exists"
fi
done < ${CLEAN_FILES}
.slug-post-clean
src
public
node_modules/.cache
output
src
]]; then exists
public
]]; then exists
node_modules/.cache
]]; then exists dules/.cache
But this code works
if [[ -d "src" ]]; then
echo "if works"
fi
output
if works
My Ubuntu version is 20.04LTS
Anyone knows what's happening?