#!/bin/bash
# Author: Ken Isaacs
# Program name: copy
# Date created: March 13, 2022
# Date modified:
# Problem:
# copy a file
# Solution:
#1. determine what source file we need to copy
#2. find the source file
#3. if source file does not exist, ????
#4. if yes, determine what the destination file is
#5. Does the destination file exist?
#6. if yes, ????
#7. open the source file
#8. open the destination file
#9. transfer data from source to destination
#10. close the source file
#11. close the destination file
#TODO: provide user help
#1. determine what source file we need to copy
#TODO: what about multiple files??
#TODO: what about directories and other types of files?
clear
echo -n "Enter the source file name: "
read sourc
#1a. check if the user input is valid
#2. find the source file
#3. if source file does not exist, present the user
#+ with another chance????
#4. if yes, determine what the destination file is
echo -n "Enter the destination file name: "
read destin
#5. Does the destination file exist?
#6. if yes, ????
#7-10 open, transfer data, close files
cp $sourc $destin
echo "copies $source to $destin"
echo "contents of $destin is:"
cat $destin
(Please send me screenshot of whole script)
【General guidance】The answer provided below has been developed in a clear step by step manner.Step1/1General Guidance:-\( \mathrm{\star} \)The answer provided below has been developed in a clear step by step manner.#!/bin/bashif [ $# -eq 0 ]; then echo "Enter the name of the source file: " read source_file echo "Enter the name of the destination file: " read dest_fileelse source_file=$1 dest_file=$2fiif [ ! -f "$source_file" ]; then echo "Error: File '$source_file' not ... See the full answer