Friday, 12 December 2014

Shell Script to Delete a directory

Write a Shell Script to Delete a directory

Solution:
echo " Enter the name of the directory to be deleted"
read s
c=`ls $s | wc -l`
if test $c = 0
then
rmdir $s
else
rm -r $s
fi     

Output:
Enter the name of the directory to be deleted

abc

No comments:

Post a Comment