0

I want to create a basic program in Unix that would display in HTML a random photo from a group of photos I selected and each time it is generated a different one would be displayed, hence random.

Example: Dog breeds and each time you ran the program an HTML page would display an image of a random dog breed.

  • 2
    I'm voting to close this question as off-topic because because this is about setting up a website, and doesn't belong in its current form on any of stackoverflow. – Anthon Sep 28 '16 at 6:24
2

Assuming your filenames don't have embedded newlines:

find /some/dir -type f -name '*.jpg' | shuf | head -1

There are much better ways to do it from a web server though.

Not the answer you're looking for? Browse other questions tagged or ask your own question.