编辑代码

#!/bin/bash

while true
do
	clear
	echo "************************************************"
	echo "*                   MENU                     *"
	echo "*          1.copy              2.rename       *"
	echo "*          3.remove           4.find         *"
	echo "*                           5.exit           *"
	echo "************************************************"
	read -p "Enter your choice: " choice
	
	case $choice in
		1)
			read -p "Enter source file name: " source
			read -p "Enter destination file name: " destination
			cp $source $destination
			echo "File copied successfully"
			;;
		2)
			read -p "Enter file or directory name to rename: " old
			read -p "Enter new name: " new
			mv $old $new
			echo "File or directory renamed successfully"
			;;
		3)
			read -p "Enter file name to remove: " file
			rm $file
			echo "File removed successfully"
			;;
		4)
			read -p "Enter keyword to search: " keyword
			grep -r $keyword *
			;;
		5)
			echo "Exiting program"
			exit 0
			;;
		*)
			echo "Invalid choice. Please try again."
			;;
	esac

	read -p "Press Enter to continue"
done