{"id":562,"date":"2025-11-19T12:42:36","date_gmt":"2025-11-19T12:42:36","guid":{"rendered":"https:\/\/sites.wp.odu.edu\/dhill036\/?page_id=562"},"modified":"2025-11-29T10:37:12","modified_gmt":"2025-11-29T10:37:12","slug":"lab-8-2","status":"publish","type":"page","link":"https:\/\/sites.wp.odu.edu\/dhill036\/lab-8-2\/","title":{"rendered":"Lab 8 &#8211; Shell Scripting"},"content":{"rendered":"\n<p><strong>My Experience on This Lab<\/strong><br>In this lab, I created and ran Bash scripts using <strong>vim<\/strong>, added the shebang line, made each script executable, and tested them in the terminal. I wrote a script to check whether a number was greater than 10, another that identified whether an input was a file or directory and created a file if it didn\u2019t exist, and an extra-credit script that validated directory names and displayed their contents.<\/p>\n\n\n\n<p><strong>Key Concepts I Learned<\/strong><br>I practiced using conditional statements, reading user input, testing files and directories (<code>-d<\/code>, <code>-f<\/code>), using redirection, and setting execute permissions with <code><strong>chmod +x<\/strong><\/code>. This reinforced how shell scripts automate system tasks.<\/p>\n\n\n\n<p><strong>Challenges <\/strong><br>The main challenge was ensuring each script handled all conditions properly, especially distinguishing files from directories. Testing different inputs helped confirm the logic.<\/p>\n\n\n\n<div data-wp-interactive=\"\" class=\"wp-block-file\"><object data-wp-bind--hidden=\"!selectors.core.file.hasPdfPreview\" hidden class=\"wp-block-file__embed\" data=\"https:\/\/sites.wp.odu.edu\/dhill036\/wp-content\/uploads\/sites\/38343\/2025\/11\/annotated-Lab208.pdf\" type=\"application\/pdf\" style=\"width:100%;height:600px\" aria-label=\"Embed of annotated-Lab208.\"><\/object><a id=\"wp-block-file--media-caa8682d-b899-48b8-bf07-9988e79649b3\" href=\"https:\/\/sites.wp.odu.edu\/dhill036\/wp-content\/uploads\/sites\/38343\/2025\/11\/annotated-Lab208.pdf\">annotated-Lab208<\/a><a href=\"https:\/\/sites.wp.odu.edu\/dhill036\/wp-content\/uploads\/sites\/38343\/2025\/11\/annotated-Lab208.pdf\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-caa8682d-b899-48b8-bf07-9988e79649b3\">Download<\/a><\/div>\n\n\n<b>PDF Embedder requires a url attribute<\/b>","protected":false},"excerpt":{"rendered":"<p>My Experience on This LabIn this lab, I created and ran Bash scripts using vim, added the shebang line, made each script executable, and tested them in the terminal. I wrote a script to check whether a number was greater than 10, another that identified whether an input was a file or directory and created&#8230; <\/p>\n<div class=\"link-more\"><a href=\"https:\/\/sites.wp.odu.edu\/dhill036\/lab-8-2\/\">Read More<\/a><\/div>\n","protected":false},"author":30353,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"_links":{"self":[{"href":"https:\/\/sites.wp.odu.edu\/dhill036\/wp-json\/wp\/v2\/pages\/562"}],"collection":[{"href":"https:\/\/sites.wp.odu.edu\/dhill036\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sites.wp.odu.edu\/dhill036\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sites.wp.odu.edu\/dhill036\/wp-json\/wp\/v2\/users\/30353"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.wp.odu.edu\/dhill036\/wp-json\/wp\/v2\/comments?post=562"}],"version-history":[{"count":5,"href":"https:\/\/sites.wp.odu.edu\/dhill036\/wp-json\/wp\/v2\/pages\/562\/revisions"}],"predecessor-version":[{"id":578,"href":"https:\/\/sites.wp.odu.edu\/dhill036\/wp-json\/wp\/v2\/pages\/562\/revisions\/578"}],"wp:attachment":[{"href":"https:\/\/sites.wp.odu.edu\/dhill036\/wp-json\/wp\/v2\/media?parent=562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}