I have the following script
var1=$(pwd)
echo $var1
if [ -e $var1 ]
then
echo present directory exists
if [ grep ^d\* | $(ls -al) ]
then
echo these are the directories in $var1
fi
else
echo failed
fi
Running this script gives the following output with errors
/home/user1/Desktop/workspace
present directory exists
ifelse.sh: 6: [: missing ]
ifelse.sh: 6: ifelse.sh: total: not found
Please explain the errors. If possible give a resource where I can learn about about Bash script errors completely. Thanq