Files
shellScripting/shell_scripting_succinctly/exercise7.sh

20 lines
452 B
Bash
Raw Normal View History

2026-02-16 18:35:44 -05:00
#!/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.
FD_NAME=$1
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