SlideShare a Scribd company logo
1 of 2
Download to read offline
#!/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)
Start with in-class Problem #1. Complete the script to copy a file. In addition to prompting for the
file name, as a last step, allow the user of your script to be able to put the source file as parameter
1 and the destination file as parameter 2 on the command line. Post the completed bash script
here so that I can test it.

More Related Content

More from advanceneruroscience

BIO 218 Chap 10 amp 11 Case Studies Case 1 Presentation.pdf
BIO 218 Chap 10 amp 11 Case Studies Case 1 Presentation.pdfBIO 218 Chap 10 amp 11 Case Studies Case 1 Presentation.pdf
BIO 218 Chap 10 amp 11 Case Studies Case 1 Presentation.pdfadvanceneruroscience
 
Binom Dalm kullanarak aadaki soruyu zn Bayfield Ontari.pdf
Binom Dalm kullanarak aadaki soruyu zn  Bayfield Ontari.pdfBinom Dalm kullanarak aadaki soruyu zn  Bayfield Ontari.pdf
Binom Dalm kullanarak aadaki soruyu zn Bayfield Ontari.pdfadvanceneruroscience
 
Binary messages may be sent in Hexadecimal 4 bit 0F Fo.pdf
Binary messages may be sent in Hexadecimal 4 bit  0F  Fo.pdfBinary messages may be sent in Hexadecimal 4 bit  0F  Fo.pdf
Binary messages may be sent in Hexadecimal 4 bit 0F Fo.pdfadvanceneruroscience
 
Biochemistry Explain what is meant by the term high ener.pdf
Biochemistry Explain what is meant by the term high ener.pdfBiochemistry Explain what is meant by the term high ener.pdf
Biochemistry Explain what is meant by the term high ener.pdfadvanceneruroscience
 
Biochemistry 6 The enzyme PFK1 catalyzes such transfer.pdf
Biochemistry   6 The enzyme PFK1 catalyzes such transfer.pdfBiochemistry   6 The enzyme PFK1 catalyzes such transfer.pdf
Biochemistry 6 The enzyme PFK1 catalyzes such transfer.pdfadvanceneruroscience
 
Bio 18 Learn R Tutorial 7 For Covid19 the population stati.pdf
Bio 18 Learn R Tutorial 7 For Covid19 the population stati.pdfBio 18 Learn R Tutorial 7 For Covid19 the population stati.pdf
Bio 18 Learn R Tutorial 7 For Covid19 the population stati.pdfadvanceneruroscience
 
biomedical Ethics For Descartes what defines huma.pdf
biomedical Ethics           For Descartes what defines huma.pdfbiomedical Ethics           For Descartes what defines huma.pdf
biomedical Ethics For Descartes what defines huma.pdfadvanceneruroscience
 
Binomial Probability Really Big Medical Center RBMC is tes.pdf
Binomial Probability Really Big Medical Center RBMC is tes.pdfBinomial Probability Really Big Medical Center RBMC is tes.pdf
Binomial Probability Really Big Medical Center RBMC is tes.pdfadvanceneruroscience
 
Bilimsel srecin ana admlarn sralar Bilimsel hipotezi bi.pdf
Bilimsel srecin ana admlarn sralar   Bilimsel hipotezi bi.pdfBilimsel srecin ana admlarn sralar   Bilimsel hipotezi bi.pdf
Bilimsel srecin ana admlarn sralar Bilimsel hipotezi bi.pdfadvanceneruroscience
 
BI 211 Graded problem set 9 The drosophila alleles for black.pdf
BI 211 Graded problem set 9 The drosophila alleles for black.pdfBI 211 Graded problem set 9 The drosophila alleles for black.pdf
BI 211 Graded problem set 9 The drosophila alleles for black.pdfadvanceneruroscience
 
Bir ABD bankasnn varlklarnn deeri ykmllklerinin altna d.pdf
Bir ABD bankasnn varlklarnn deeri ykmllklerinin altna d.pdfBir ABD bankasnn varlklarnn deeri ykmllklerinin altna d.pdf
Bir ABD bankasnn varlklarnn deeri ykmllklerinin altna d.pdfadvanceneruroscience
 
BigOn2 order of growth corresponds to which of the follow.pdf
BigOn2 order of growth corresponds to which of the follow.pdfBigOn2 order of growth corresponds to which of the follow.pdf
BigOn2 order of growth corresponds to which of the follow.pdfadvanceneruroscience
 
Biggie Logistics has communications needs that span the glob.pdf
Biggie Logistics has communications needs that span the glob.pdfBiggie Logistics has communications needs that span the glob.pdf
Biggie Logistics has communications needs that span the glob.pdfadvanceneruroscience
 
Billynin fayda fonksiyonu Ua b a + 2bdir burada a el.pdf
Billynin fayda fonksiyonu Ua b  a + 2bdir burada a el.pdfBillynin fayda fonksiyonu Ua b  a + 2bdir burada a el.pdf
Billynin fayda fonksiyonu Ua b a + 2bdir burada a el.pdfadvanceneruroscience
 
Bilginizi elde ettiiniz kaynaklarn eitliliini gstermek ii.pdf
Bilginizi elde ettiiniz kaynaklarn eitliliini gstermek ii.pdfBilginizi elde ettiiniz kaynaklarn eitliliini gstermek ii.pdf
Bilginizi elde ettiiniz kaynaklarn eitliliini gstermek ii.pdfadvanceneruroscience
 
Big data include structured and unstructured types of data .pdf
Big data include structured and unstructured types of data .pdfBig data include structured and unstructured types of data .pdf
Big data include structured and unstructured types of data .pdfadvanceneruroscience
 
Bernard and Ernesto are a married couple and are coowners o.pdf
Bernard and Ernesto are a married couple and are coowners o.pdfBernard and Ernesto are a married couple and are coowners o.pdf
Bernard and Ernesto are a married couple and are coowners o.pdfadvanceneruroscience
 
Besides the thymine and uracil base difference which DNA st.pdf
Besides the thymine and uracil base difference which DNA st.pdfBesides the thymine and uracil base difference which DNA st.pdf
Besides the thymine and uracil base difference which DNA st.pdfadvanceneruroscience
 

More from advanceneruroscience (18)

BIO 218 Chap 10 amp 11 Case Studies Case 1 Presentation.pdf
BIO 218 Chap 10 amp 11 Case Studies Case 1 Presentation.pdfBIO 218 Chap 10 amp 11 Case Studies Case 1 Presentation.pdf
BIO 218 Chap 10 amp 11 Case Studies Case 1 Presentation.pdf
 
Binom Dalm kullanarak aadaki soruyu zn Bayfield Ontari.pdf
Binom Dalm kullanarak aadaki soruyu zn  Bayfield Ontari.pdfBinom Dalm kullanarak aadaki soruyu zn  Bayfield Ontari.pdf
Binom Dalm kullanarak aadaki soruyu zn Bayfield Ontari.pdf
 
Binary messages may be sent in Hexadecimal 4 bit 0F Fo.pdf
Binary messages may be sent in Hexadecimal 4 bit  0F  Fo.pdfBinary messages may be sent in Hexadecimal 4 bit  0F  Fo.pdf
Binary messages may be sent in Hexadecimal 4 bit 0F Fo.pdf
 
Biochemistry Explain what is meant by the term high ener.pdf
Biochemistry Explain what is meant by the term high ener.pdfBiochemistry Explain what is meant by the term high ener.pdf
Biochemistry Explain what is meant by the term high ener.pdf
 
Biochemistry 6 The enzyme PFK1 catalyzes such transfer.pdf
Biochemistry   6 The enzyme PFK1 catalyzes such transfer.pdfBiochemistry   6 The enzyme PFK1 catalyzes such transfer.pdf
Biochemistry 6 The enzyme PFK1 catalyzes such transfer.pdf
 
Bio 18 Learn R Tutorial 7 For Covid19 the population stati.pdf
Bio 18 Learn R Tutorial 7 For Covid19 the population stati.pdfBio 18 Learn R Tutorial 7 For Covid19 the population stati.pdf
Bio 18 Learn R Tutorial 7 For Covid19 the population stati.pdf
 
biomedical Ethics For Descartes what defines huma.pdf
biomedical Ethics           For Descartes what defines huma.pdfbiomedical Ethics           For Descartes what defines huma.pdf
biomedical Ethics For Descartes what defines huma.pdf
 
Binomial Probability Really Big Medical Center RBMC is tes.pdf
Binomial Probability Really Big Medical Center RBMC is tes.pdfBinomial Probability Really Big Medical Center RBMC is tes.pdf
Binomial Probability Really Big Medical Center RBMC is tes.pdf
 
Bilimsel srecin ana admlarn sralar Bilimsel hipotezi bi.pdf
Bilimsel srecin ana admlarn sralar   Bilimsel hipotezi bi.pdfBilimsel srecin ana admlarn sralar   Bilimsel hipotezi bi.pdf
Bilimsel srecin ana admlarn sralar Bilimsel hipotezi bi.pdf
 
BI 211 Graded problem set 9 The drosophila alleles for black.pdf
BI 211 Graded problem set 9 The drosophila alleles for black.pdfBI 211 Graded problem set 9 The drosophila alleles for black.pdf
BI 211 Graded problem set 9 The drosophila alleles for black.pdf
 
Bir ABD bankasnn varlklarnn deeri ykmllklerinin altna d.pdf
Bir ABD bankasnn varlklarnn deeri ykmllklerinin altna d.pdfBir ABD bankasnn varlklarnn deeri ykmllklerinin altna d.pdf
Bir ABD bankasnn varlklarnn deeri ykmllklerinin altna d.pdf
 
BigOn2 order of growth corresponds to which of the follow.pdf
BigOn2 order of growth corresponds to which of the follow.pdfBigOn2 order of growth corresponds to which of the follow.pdf
BigOn2 order of growth corresponds to which of the follow.pdf
 
Biggie Logistics has communications needs that span the glob.pdf
Biggie Logistics has communications needs that span the glob.pdfBiggie Logistics has communications needs that span the glob.pdf
Biggie Logistics has communications needs that span the glob.pdf
 
Billynin fayda fonksiyonu Ua b a + 2bdir burada a el.pdf
Billynin fayda fonksiyonu Ua b  a + 2bdir burada a el.pdfBillynin fayda fonksiyonu Ua b  a + 2bdir burada a el.pdf
Billynin fayda fonksiyonu Ua b a + 2bdir burada a el.pdf
 
Bilginizi elde ettiiniz kaynaklarn eitliliini gstermek ii.pdf
Bilginizi elde ettiiniz kaynaklarn eitliliini gstermek ii.pdfBilginizi elde ettiiniz kaynaklarn eitliliini gstermek ii.pdf
Bilginizi elde ettiiniz kaynaklarn eitliliini gstermek ii.pdf
 
Big data include structured and unstructured types of data .pdf
Big data include structured and unstructured types of data .pdfBig data include structured and unstructured types of data .pdf
Big data include structured and unstructured types of data .pdf
 
Bernard and Ernesto are a married couple and are coowners o.pdf
Bernard and Ernesto are a married couple and are coowners o.pdfBernard and Ernesto are a married couple and are coowners o.pdf
Bernard and Ernesto are a married couple and are coowners o.pdf
 
Besides the thymine and uracil base difference which DNA st.pdf
Besides the thymine and uracil base difference which DNA st.pdfBesides the thymine and uracil base difference which DNA st.pdf
Besides the thymine and uracil base difference which DNA st.pdf
 

Recently uploaded

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxAnaBeatriceAblay2
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 

Recently uploaded (20)

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 

binbash Author Ken Isaacs Program name copy Date.pdf

  • 1. #!/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) Start with in-class Problem #1. Complete the script to copy a file. In addition to prompting for the
  • 2. file name, as a last step, allow the user of your script to be able to put the source file as parameter 1 and the destination file as parameter 2 on the command line. Post the completed bash script here so that I can test it.