Well I've this code
dirname=
if [ -d $dirname ];
then
cd $dirname && rm *
fi
as you see I've this empty variable, what I want to know is why when using thing like this empty variable with the single square brackets it removes all the user's home directory files
And if I used the double square brackets it does not remove the user's home directory files
Like this
dirname=
if [[ -d $dirname ]];
then
cd $dirname && rm *
fi
I've read the difference syntax when using both Single Square Brackets and Double Square Brackets
May I know why this happens ?