QuestionQuestion

Your task is to create a tcsh shell script that is able to backup all the C program files in your current directory.
The algorithm is as follows:
• If a backup directory does not exist, then prompt the user if they would like to make one.
• If the user responds "y" or "yes" in either capitals or lowercase, then make the backup directory (in your current working directory)
• If the user responds "n" or "no" in either capitals or lowercase, then produce a message that no directory was created
• otherwise, print a message that an invalid response was entered
• If the backup directory exists
• For each .c file:
• If there have been changes to the file since the last backup, then copy the current .c file to the backup directory
• Else (if no copy exists in the backup directory) copy it
• (Otherwise, no copy will be made)
The following is a shell script that makes backups to a "backup" directory in your home directory: bckup.sh
You might want to take ideas from it, but note that it does not prompt you if you would like to make the directory.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#!/bin/tcsh

set backupDir=backupdir

echo "remove backupdir"
if ( -d $backupDir ) then
   rm -r $backupDir
endif

ls -l

echo "Type NO"
./backup.sh # Type "NO" to creating a backup directory
echo "Type n"
./backup.sh # Type "n" to creating a backup directory
echo "Type up"
./backup.sh # Type "up" to creating a backup directory
echo "Type yes"
./backup.sh # Type "yes" to creating a backup directory

ls -l $backupDir

echo "remove backupdir"
rm -r $backupDir

echo "Type Yes"
./backup.sh # Type "Yes" to creating a backup directory...
$30.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Linux Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats