0

I'm using a raspberry pi for a digital art project by displaying images in a ascii form on a monitor but I would like it to rotate through random images in the folder every hour. I have a bash script set up to just run the basic command down below.

ascii-image-converter Pictures/IMAGE HERE.png -c -C --color-bg -f -m " .-=+!@#$%&*()" 

How would I add a random function to this command and time the bash script to run at certain intervals?

4
  • 3
    You're asking two different questions, both of which have already been answered on stackoverflow, so check them out: picking random file/folder) stackoverflow.com/questions/414164/…, scheduling) stackoverflow.com/questions/16543715/…. In addition to cron, there's also systemd-timers (and other packages), but cron is quicker and easier to get started with. Commented Mar 4, 2022 at 6:23
  • For randomness, see the bash variable RANDOM and the device /dev/urandom. Commented Mar 4, 2022 at 6:44
  • BTW, before I closed it as a duplicate, this question was on a route towards being closed as too broad to be on topic. Only one specific, narrow technical problem to a single Stack Overflow question -- if you have two technical problems, ask two separate questions, after searching for existing questions answering each of those smaller problems! Commented Mar 4, 2022 at 14:34
  • I really do recommend using systemd timers if your operating system uses systemd. Not only do they have more features than vixie cron, but they work without needing cron installed so you don't need an extra daemon, and the same tools you use for checking status and logs of other services work for scheduled jobs. Commented Mar 4, 2022 at 14:56

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.