SOURCE CODE:
echo “1: File having only 3 char."
echo “2: File having specified extension.”
echo “3: File having name starting with lower case letters and ends at digits.”
echo “Enter your choice:”
read c
if [ $c = 1 ]
then
echo “Files are…”
ls ???
read s
if [ $s = ‘y’ ]
then
for file in `ls ??? `
do
rm $file
done
else
break
fi
fi
if [ $c = 3 ]
then
echo “Files are…”
ls [ a-z ] * [0-9]
echo “Do you want to delete these files?y/n”
read s
if [ $s = ‘y’ ]
then
for file in `ls [ a-z ] * [0-9] `
do
rm $file
done
else
break
fi
fi
if [ $c = 2 ]
then
echo “Enter the special extension of file”
read e
echo “Files are…”
ls *.$e
echo “Do you want to delete these files?y/n”
read s
if [ $s = ‘y’ ]
then
for file in `ls * $e`
do
rm $file
done
else
break
fi
fi
OUTPUT:
1: File having only 3 char.
2: File having specified extension.
3: File having name starting with lower case letters and ends at digits.
Enter your choice:
3
Files are...
Desktop
Documents
Downloads
Music
Pictures
Public
Videos
Do you want to delete these files?y/n
n
No comments :
Post a Comment