Created
          April 22, 2016 21:35 
        
      - 
      
- 
        Save cattleguard/fcc3a9c40b08d41a8f58ff0d2100d3b1 to your computer and use it in GitHub Desktop. 
    Adds a game to your retropie NES called 'Feeling Lucky' which launches a random game from your collection.
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/bash | |
| # Description: | |
| # Adds a game to your retropie NES called 'Feeling Lucky' which launches a random game from your collection | |
| # INSTALL: Point your nes launcher in /etc/emulationstation/es_systems.cfg | |
| # to this script. (e.g. /home/pi/NES_feeling_lucky.sh %ROM%) | |
| flag="$HOME/RetroPie/roms/nes/Feeling Lucky.nes" | |
| if [ ! -e "$flag" ] | |
| then | |
| touch "$flag" | |
| fi | |
| gamename=`basename "$1"` | |
| if [ "$gamename" == "Feeling Lucky.nes" ] | |
| then | |
| files=($HOME/RetroPie/roms/nes/*) | |
| exit `/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ nes "${files[RANDOM % ${#files[@]}]}"` | |
| else | |
| exit `/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ nes "$1"` | |
| fi | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment