From aa4bbd3ed582f0608ec4ced23e7cd86d5ddadee4 Mon Sep 17 00:00:00 2001 From: mlot Date: Fri, 6 Feb 2026 13:39:28 -0500 Subject: [PATCH] add exercise6.sh, template.sh --- shell_scripting_succinctly/exercise6.sh | 19 +++++++++++++++++++ template.sh | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 shell_scripting_succinctly/exercise6.sh create mode 100644 template.sh diff --git a/shell_scripting_succinctly/exercise6.sh b/shell_scripting_succinctly/exercise6.sh new file mode 100644 index 0000000..0c08e16 --- /dev/null +++ b/shell_scripting_succinctly/exercise6.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# +# Prompts the user for a file or directory name and reports if it is +# a regular file or directory. +# Also performs an 'ls' long listing command against the file or directory. + +# Main body of shell script starts here. +read -p "Enter the name of a file or directory: " FD_NAME + +if [ -f $FD_NAME ] +then + echo "${FD_NAME} is a regular file or directory." + ls -l $FD_NAME +else + echo "${FD_NAME} is NOT a regular file or directory." +fi + +# Exit with an explicit exit status. +exit 0 diff --git a/template.sh b/template.sh new file mode 100644 index 0000000..87dd408 --- /dev/null +++ b/template.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +# +# + +GLOBAL_VAR1="one" +GLOBAL_VAR2="two" + +function function_one() { + local LOCAL_VAR1="one" + # +} + +# Main body of shell script starts here. +# +# +# + +# Exit with an explicit exit status. +exit 0