Bash commands

I have a question regarding bash scripting.
I’m working on a project for my job. Basically I use
ls -1d *.txt > foo
to generate a foo document of all the text files in a directory.
I then have to go in and manually add a prefix to each line in the foo document to get something like
./ filename.txt
Is there a way to add the prefix “./ “ to the ls > foo command to have this all done at once?
Thank you!

A standard loop should do the job nicely enough in most situations.

1 Like

@tgrtim thanks!! I was able to get it to work!