{"id":370,"date":"2025-11-30T23:21:12","date_gmt":"2025-11-30T23:21:12","guid":{"rendered":"https:\/\/sites.wp.odu.edu\/dberr012\/?p=370"},"modified":"2025-11-30T23:21:12","modified_gmt":"2025-11-30T23:21:12","slug":"cyse270-assignment-8","status":"publish","type":"post","link":"https:\/\/sites.wp.odu.edu\/dberr012\/2025\/11\/30\/cyse270-assignment-8\/","title":{"rendered":"CYSE270 Assignment 8"},"content":{"rendered":"\n<p><strong>Task A (Correct script (25 points) + result\/output after executing the script (25 points)-<\/strong><\/p>\n\n\n\n<p><strong>Conditional Statement<\/strong><\/p>\n\n\n\n<p><strong>Write a shell script using nano or vi editor (eg, vi scriptname.sh) like below, that performs<\/strong><\/p>\n\n\n\n<p><strong>the following task:<\/strong><\/p>\n\n\n\n<p><strong>1. Add the Shebang (#!\/bin\/bash) as the first line in your script.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-17-1024x640.jpeg\" alt=\"\" class=\"wp-image-374\" srcset=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-17-1024x640.jpeg 1024w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-17-300x188.jpeg 300w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-17-768x480.jpeg 768w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-17-1536x960.jpeg 1536w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-17-480x300.jpeg 480w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-17.jpeg 1600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>2. Read a number using read function<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-14-1024x640.jpeg\" alt=\"\" class=\"wp-image-371\" srcset=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-14-1024x640.jpeg 1024w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-14-300x188.jpeg 300w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-14-768x480.jpeg 768w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-14-1536x960.jpeg 1536w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-14-480x300.jpeg 480w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-14.jpeg 1600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>3. Using the if statement, check if the input number is greater than 10, then print the message \u201cInput number is greater than 10\u201d.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-15-1024x640.jpeg\" alt=\"\" class=\"wp-image-372\" srcset=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-15-1024x640.jpeg 1024w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-15-300x188.jpeg 300w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-15-768x480.jpeg 768w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-15-1536x960.jpeg 1536w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-15-480x300.jpeg 480w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-15.jpeg 1600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>4. If the number is not greater than 10, then print the message, \u201cInput number is not greater than 10\u201d.<\/strong><\/p>\n\n\n\n<p><strong>(Your script should result into the output similar to this sample screenshot after executing as shown below)<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-18-1024x640.jpeg\" alt=\"\" class=\"wp-image-376\" srcset=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-18-1024x640.jpeg 1024w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-18-300x188.jpeg 300w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-18-768x480.jpeg 768w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-18-1536x960.jpeg 1536w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-18-480x300.jpeg 480w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-18.jpeg 1600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Task B (Correct script (25 points) + result\/output after executing the script (25 points) &#8211;<\/strong><\/p>\n\n\n\n<p><strong>Shell Script to Create a new file<\/strong><\/p>\n\n\n\n<p><strong>Write a shell script using nano or vi editor (eg, nano scriptname.sh) like below, that<\/strong><\/p>\n\n\n\n<p><strong>performs the following task:<\/strong><\/p>\n\n\n\n<p><strong>1. Add the Shebang (#!\/bin\/bash) as the first line in your script.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-16-1024x640.jpeg\" alt=\"\" class=\"wp-image-373\" srcset=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-16-1024x640.jpeg 1024w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-16-300x188.jpeg 300w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-16-768x480.jpeg 768w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-16-1536x960.jpeg 1536w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-16-480x300.jpeg 480w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-16.jpeg 1600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>2. Reads the name of the file to check for a filename that exists.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-19-1024x640.jpeg\" alt=\"\" class=\"wp-image-375\" srcset=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-19-1024x640.jpeg 1024w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-19-300x188.jpeg 300w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-19-768x480.jpeg 768w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-19-1536x960.jpeg 1536w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-19-480x300.jpeg 480w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-19.jpeg 1600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>3. Check whether the given input is a directory or regular file.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-20-1024x640.jpeg\" alt=\"\" class=\"wp-image-377\" srcset=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-20-1024x640.jpeg 1024w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-20-300x188.jpeg 300w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-20-768x480.jpeg 768w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-20-1536x960.jpeg 1536w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-20-480x300.jpeg 480w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-20.jpeg 1600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>4. If the input is a directory and exists, then display the message \u201cDirectory exists\u201d.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-22-1024x640.jpeg\" alt=\"\" class=\"wp-image-379\" srcset=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-22-1024x640.jpeg 1024w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-22-300x188.jpeg 300w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-22-768x480.jpeg 768w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-22-1536x960.jpeg 1536w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-22-480x300.jpeg 480w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-22.jpeg 1600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>5. If the input is a regular file, then display the message \u201cIt is a regular file, and the file exists\u201d and display the contents of the file.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-21-1024x640.jpeg\" alt=\"\" class=\"wp-image-378\" srcset=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-21-1024x640.jpeg 1024w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-21-300x188.jpeg 300w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-21-768x480.jpeg 768w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-21-1536x960.jpeg 1536w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-21-480x300.jpeg 480w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-21.jpeg 1600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>6. If the given input name in step-1 doesn\u2019t exist, then create the new file with the given name in step-1.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-23-1024x640.jpeg\" alt=\"\" class=\"wp-image-380\" srcset=\"https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-23-1024x640.jpeg 1024w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-23-300x188.jpeg 300w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-23-768x480.jpeg 768w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-23-1536x960.jpeg 1536w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-23-480x300.jpeg 480w, https:\/\/sites.wp.odu.edu\/dberr012\/wp-content\/uploads\/sites\/39158\/2025\/11\/image-23.jpeg 1600w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Task A (Correct script (25 points) + result\/output after executing the script (25 points)- Conditional Statement Write a shell script using nano or vi editor (eg, vi scriptname.sh) like below, that performs the following task: 1. Add the Shebang (#!\/bin\/bash) as the first line in your script. 2. Read a number using read function 3&#8230;. <\/p>\n<div class=\"link-more\"><a href=\"https:\/\/sites.wp.odu.edu\/dberr012\/2025\/11\/30\/cyse270-assignment-8\/\">Read More<\/a><\/div>\n","protected":false},"author":30971,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","wds_primary_category":0},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/sites.wp.odu.edu\/dberr012\/wp-json\/wp\/v2\/posts\/370"}],"collection":[{"href":"https:\/\/sites.wp.odu.edu\/dberr012\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sites.wp.odu.edu\/dberr012\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sites.wp.odu.edu\/dberr012\/wp-json\/wp\/v2\/users\/30971"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.wp.odu.edu\/dberr012\/wp-json\/wp\/v2\/comments?post=370"}],"version-history":[{"count":1,"href":"https:\/\/sites.wp.odu.edu\/dberr012\/wp-json\/wp\/v2\/posts\/370\/revisions"}],"predecessor-version":[{"id":381,"href":"https:\/\/sites.wp.odu.edu\/dberr012\/wp-json\/wp\/v2\/posts\/370\/revisions\/381"}],"wp:attachment":[{"href":"https:\/\/sites.wp.odu.edu\/dberr012\/wp-json\/wp\/v2\/media?parent=370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sites.wp.odu.edu\/dberr012\/wp-json\/wp\/v2\/categories?post=370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sites.wp.odu.edu\/dberr012\/wp-json\/wp\/v2\/tags?post=370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}