diff options
| author | mo <mo.khan@gmail.com> | 2019-05-25 19:35:20 -0600 |
|---|---|---|
| committer | mo <mo.khan@gmail.com> | 2019-05-25 19:35:20 -0600 |
| commit | 9508685fbd434d3bb2762c94ac425fa721f7915e (patch) | |
| tree | 54eb631182b04d030146cd53d2152e8d70f11717 | |
| parent | 498db3bdcdedb7d603817b78141e167f8ad05c67 (diff) | |
extract main and banner functions
| -rwxr-xr-x | bin/problem-13.sh | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/bin/problem-13.sh b/bin/problem-13.sh index 77cd32e..b29cd4b 100755 --- a/bin/problem-13.sh +++ b/bin/problem-13.sh @@ -1,21 +1,29 @@ #!/bin/sh -echo "Use one of the following options:" -echo " d: To display today's date and present time" -echo " l: To see the listing of files in your present working directory" -echo " w: To see who's logged in" -echo " q: To quit this program" -echo "Enter your option and hit <Enter>:" +banner() { + echo "Use one of the following options:" + echo " d: To display today's date and present time" + echo " l: To see the listing of files in your present working directory" + echo " w: To see who's logged in" + echo " q: To quit this program" + echo "Enter your option and hit <Enter>:" +} -read option -case "$option" in - d) date - ;; - l) ls - ;; - w) who - ;; - q) exit 0 - ;; -esac -exit 0 +main() { + banner + + read option + case "$option" in + d) date + ;; + l) ls + ;; + w) who + ;; + q) exit 0 + ;; + esac + exit 0 +} + +main |
