Added if statement in the script, rather than using || directy in the command.
Removed unnecessary else condition.
Also check the parent directory.
Use a local variable instead of script variable.
Merge 'pull-request-1'