I am creating a simple backup script and I want to check if the directory exists in the specified path:
fullPath=/usr/local/webapps/mydir if mydir exists in my $fullPath then back it up else give error fi
My question is: how to formulate an if statement to check if the last directory exists in the $ fullPath variable? To clarify, for this case it would be mydir , if I used / usr / local, it would be local , etc.
Thanks in advance!
Mantas
source share