Hello,
I am doing a scripting assignment, and I have everything done except for setting my INFODIR variable to the current working directory. How do I go abouts doing this?
I have attached my code for reference.
Code:
#!/bin/bash
INFODIR=./
if [ $# -gt 1 ]; then
echo “Usage: fileinfo [directory path]”
exit 1
elif [ $# -lt 1 ]; then
INFODIR=$1
fi
echo "Processing $INFODIR"
for i in $INFODIR/*; do
set -- $(ls -l $INFODIR/$i)
echo "|"
echo "|+ Name : $8"
echo "| L Owner : $3"
echo "| L Permissions : $1"
echo "| L Size : $5"
YN="X"
while [ $YN != "y" -a $YN != "n" ]
do
echo "| > [?] Would you like to delete $8 (y/n)? "
read YN
if [[ $YN = y ]]; then
rm $INFODIR/$1
fi
done
done