Issue
We have a situation where we need to run specific set of tests, if a folder is present in a specific path.
If other files are folders present along with this folder, we need to run different set of commands.
If {only this folder present}
Run scriptA.sh
Elseif {this folder and other folders/files}
Run scriptB.sh
Fi
Solution
if [ $( ls | wc -l ) -eq 1 && ( -d "$myfolder" ) ]; then
scriptA.sh
else
scriptB.sh
fi
This confirms only my folder exists, nothing else. Let me know what you all think.
Answered By - Oxycash Answer Checked By - Clifford M. (WPSolving Volunteer)