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.

1
  • 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. Commented Sep 28, 2016 at 6:24

1 Answer 1

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.