Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using vi in linux make a script type menu that do the following things: Menu: 1)

ID: 3737756 • Letter: U

Question

Using vi in linux make a script type menu that do the following things:


Menu:


1)Search for a file and delete it


2) Create a directory called "repository"


3) Make a ftp server from the server to your machine (client)


4) Do a reboot to your computer


5) Send this created scrip to a email you desire


6)exit


Note:
in point 2 you must copy everything inside that directory

in point 3 the ftp servrr must be in command lines

in point 5 you must put in a subject first name and last name to the email you desire to send

Explanation / Answer

#!/bin/bash

if [ $1 -eq 1 ]
then
read -p "Enter file name: " fl
echo -e " "
read -p "Enter directory to search in: " dr
echo -e " "
find $dr -name $fl
fi

if [ $1 -eq 2 ]
then
mkdir ./repository
echo -e "repository directory created "
fi

if [ $1 -eq 3 ]
then
read -p "Enter an IP address or hostname to connect: " ip
ftp $ip
fi

if [ $1 -eq 4 ]
then
shutdown -h now
fi

if [ $1 -eq 5 ]
then
read -p "Enter an email ID :" em
mail -s "FIRSTNAME LASTNAME" $em <<< 'This is body of the mail '
fi