#!/bin/sh
if [ "$1" == "" ]; then
echo "Syntax: $0 filenames"
echo "(filenames can be any (positive) number of files)"
exit 1
fi
for file in $@
do
[ -f $file ] && echo "Full Path: $file - Base Filename: $(basename $file)"
# note: Full Path will only contain a path if the input arguments contain paths.
# basename will always strip the path, if any
# the [ -f $file ] bit filters out files only, so we don't process directories
done
No comments:
Post a Comment