OSA Assignment 1 Code

# ! bin/bash
while true
do
echo "Menu"
echo "1. Create file "
echo "2. Rename file "
echo "3. Delete file "
echo "4. Display "
echo "5. Exit "

echo "Enter your choice "
read ch
case $ch in
1) echo "Enter the file name "
read s1
if [ -f $s1 ]
then
echo "File is already present "
else
touch $s1
echo "file is created "
fi
;;
2) echo "Enter the old name "
read s1
if [ -f $s1]
then
mv $s1 $s2
echo "File s1 successfully renamed to s2 "
else
echo "file not exist "
fi
;;
3) echo "Enter the filename which u want to delete "
read s2
if [-f $s1 ]
then
rm $s1
echo "file $s1 is deleted "
else
echo "$s1 is not present "
fi
;;
4) ls -l
;;
5) exit ;;
esac
done
SHARE
    Blogger Comment
    Facebook Comment