I am trying to loop through a directory with a few .txt files in bash. I have very little experience with bash but I need to use it because I can run other commands once I get the contents of each file. I 
want to do this:

```
for file in <directory>; do
    read its contents
    do something with the contents
done

```

I found that to read a file you can do this with one file if I hard code the file name:

```
contents = $(<filename.txt)

```

and to loop through all files in a directory I am doing this:

```
for file in dir; do

done

```

I want to be able to loop through all files and read them with the file variable in the loop.
But inside the loop none of these work (I have tried combinations of these as well): 

```
for file in dir; do
    contents = $(<$file)
done

for file in dir; do
     contents = $(<"$file")
done

for file in dir; do
     contents = $(<${file##*/})
done

for file in dir; do
     contents = $(<"${file##*/}")
done

for file in dir; do
     contents = $(<$(basename "$file"))
done

for file in dir; do
     filename = $(basename "$file")
     contents = $(<$filename)
done

for file in dir; do
     filename = "${file##*/}"
     contents = $(<$filename)
done

```

Thanks for help in advance.