Skip to content

Instantly share code, notes, and snippets.

@kellylawrence
Last active June 23, 2020 22:10
Show Gist options
  • Save kellylawrence/2b3d6ea9092ac9d7357260f9d79c5597 to your computer and use it in GitHub Desktop.
Save kellylawrence/2b3d6ea9092ac9d7357260f9d79c5597 to your computer and use it in GitHub Desktop.
Simple bash script to randomly set a `launching.jpg` runcommand image. Place in `/opt/retropie/configs/all`. More info at https://github.com/retropie/retropie-setup/wiki/runcommand#adding-custom-launching-images.
#!/bin/bash
# 1.1
# (c) Jun 2020 Kelly Lawrence
# Set current directory to location of this bash script.
cd "$(dirname "$0")"
# Randomly rename all (*.jpg) image files in current directory.
for F in *.jpg ; do
sudo mv $F $RANDOM.jpg
done
# Get one random (*.jpg) image file.
ImageFile=$( find ./ -maxdepth 1 -name "*.jpg" | shuf -n 1 )
# Rename selected (*.jpg) image file to `launching.jpg`.
sudo mv $ImageFile launching.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment