I'm trying to iterate over each file in a directory. Here's my code so far.
while read inputline
do
input="$inputline"
echo "you entered $input";
if [ -d "${input}" ]
then
echo "Good Job, it's a directory!"
for d in $input
do
echo "This is $d in directory."
done
exit
my output is always just one line
this is $input directory.
why isn't this code working? what am I doing wrong?
Cool. When I echo it prints out
$input/file
Why does it do that? Shouldn't it just print out the file without the directory prefix?