-1

I have a folder containing some HTML files and I want to obtain some URLs based on the file names. So, or example, I have these files:

  • hello.html
  • goodby.html
  • iloveyou.html

And I want to get:

How do I do that with bash?

Thank you in advance!

1 Answers1

0
for FILE in folder/*.html
do
  do_something_with "http://google.com/${FILE}"
done
Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
A. L. Flanagan
  • 1,162
  • 8
  • 22
  • 1
    Generally a good answer -- only note here is that the use of an all-caps variable name is contrary to convention. See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html -- all-caps names are used for variables meaningful to the shell or POSIX-specified utilities, whereas lowercase names are reserved for application use and guaranteed not to conflict with the behavior of a compliant (read: non-zsh) shell. (Otherwise, people can all too easily run `for PATH in ...`, and then wonder why they can no longer run external commands). – Charles Duffy May 08 '18 at 19:58
  • Ha! Good point. I learned something, thanks. – A. L. Flanagan May 11 '18 at 19:38