add exercise6.sh, template.sh

This commit is contained in:
mlot
2026-02-06 13:39:28 -05:00
parent 855cce0ce8
commit aa4bbd3ed5
2 changed files with 39 additions and 0 deletions

View File

@@ -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

20
template.sh Normal file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
#
# <Replace with the purpose or description of of this shell script.>
#
GLOBAL_VAR1="one"
GLOBAL_VAR2="two"
function function_one() {
local LOCAL_VAR1="one"
# <Replace with function code.>
}
# Main body of shell script starts here.
#
# <Replace with the main commands of your shell script.>
#
# Exit with an explicit exit status.
exit 0