This is my demo.sh file
#!/bin/bash
if [[ $(ls -A) ]]; then
echo "there are files"
else
echo "no files found"
fi
but when i run this i get output as
demo.sh: 3: demo.sh: [[: not found
no files found
but there is some file on this directory
[[
like shopt is a bash feature, so you should use a shebang in your script or run it with bash – muru Sep 15 '17 at 13:46#!/bin/bash
– sudodus Sep 15 '17 at 13:48bash demo.sh
or./demo.sh
– muru Sep 15 '17 at 13:56