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

UBUNTU Shell Script Make a shell script in UBUNTU that permits: 1. Create a grou

ID: 3754792 • Letter: U

Question

UBUNTU Shell Script

Make a shell script in UBUNTU that permits:

1. Create a group named cpen452

2. Create a user which group be cpen 452

3. Search all the files with extension .txt and and delete them

4. Create a directory called quiz and create in that directory 10 files with the same name that the last characters be a consecutive number between 0 and 9; everything has to be realized with the same command.

5. Realize a copy of the home directory in a usb

6. List all the processes en the system y ("Kill") one of them according to relevance

7. Send a message to all the users of the system : "Save all your work and close session, the system will turn off in 2 minutes"

8. Close

Exit

*Copy the script in the home directory (of each one of the integrants)

I want to create a "menu" in a script that allows all that

Explanation / Answer

sudo groupadd -g 10000 cpen452
sudo useradd -G cpen452 cpen452
find . -type f -name "*.txt"
mkdir quiz
cd quiz
today="$( date +"%Y%m%d" )"
number=0

while test -e "$today$suffix.txt"; do
    (( ++number ))
    suffix="$( printf -- '-%02d' "$number" )"
done

fname="$today$suffix.txt"

printf 'Will use "%s" as filename ' "$fname"
touch "$fname"


we are allowed to do only 4 exercise out of any number of given so i did first 4 except deletion of text file if you do that all files will be deleted and have to recover or may be get recover so be aware for that , if you have doubt in above 4 use can ask me anytime , if you like please thumbs up for that , thanks :)