RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    runcommand.sh should run commands

    Scheduled Pinned Locked Moved Help and Support
    runcommand.shemulationstatonretropie os
    7 Posts 5 Posters 1.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • BenMcLeanB
      BenMcLean
      last edited by BenMcLean

      Can anyone explain to me how the hell to make runcommand.sh just ... run .... commands .... why doesn't it just run commands .... why doesn't it ... just .... run .... commands why doesn't it just run commands

      How do I make it just run a command?

      "go edit some cfg file to ..." No. How do I make it just run a command?

      It's called runcommand.sh

      It should just run commands.

      There should be some way to have it just run a command.

      Just run.

      A command.

      I may be looking at this wrong, but it looks like there isn't a way to have it just run a command.

      https://github.com/RetroPie/RetroPie-Setup/blob/a9198687e573694f01fd0b434100b86b1babff9e/scriptmodules/supplementary/runcommand/runcommand.sh#L173-L209

      How many Tide pods did whoever wrote that eat to make them not realize that sometimes people are going to want to just run commands?

      I'm using latest RetroPie on Raspberry PI 400. And I want to add a .sh file as menu item to the Ports menu that will run any arbitrary linux command I put in the .sh file. I believe that's all the technical information I need to specify for this issue but please let me know why additional information is required if it is.

      There needs to be a default way to add a menu item that will run any arbitrary Linux terminal command without having to edit any other files and then resume EmulationStation when it's done. Or at least some way to turn that on. Or it needs to be in the documentation and easy to find.

      Am I wrong?

      dankcushionsD 1 Reply Last reply Reply Quote -4
      • S
        sleve_mcdichael
        last edited by sleve_mcdichael

        It should be as simple as putting your .sh files in ~/RetroPie/retropiemenu or ~/RetroPie/roms/ports and then run them from the "RetroPie" or "Ports" menu in EmulationStation.

        BenMcLeanB 1 Reply Last reply Reply Quote 1
        • dankcushionsD
          dankcushions Global Moderator @BenMcLean
          last edited by

          @benmclean said in runcommand.sh should run commands:

          How many Tide pods did whoever wrote that eat to make them not realize that sometimes people are going to want to just run commands?

          write your own script or stop being obnoxious.

          I'm using latest RetroPie on Raspberry PI 400. And I want to add a .sh file as menu item to the Ports menu that will run any arbitrary linux command I put in the .sh file. I believe that's all the technical information I need to specify for this issue but please let me know why additional information is required if it is.

          i expect your script is bogus (show it) or you've not given it +x permissions. either way, you can progress this issues after some time spent reflecting how to ask for assistance with free software.

          1 Reply Last reply Reply Quote 4
          • Lister of SmegL
            Lister of Smeg
            last edited by

            ?sometimes I wonder if users are confusing 'runcommand.sh' with the actual command prompt?

            1 Reply Last reply Reply Quote 0
            • BenMcLeanB
              BenMcLean @sleve_mcdichael
              last edited by BenMcLean

              @sleve_mcdichael said in runcommand.sh should run commands:

              It should be as simple as putting your .sh files in ~/RetroPie/retropiemenu or ~/RetroPie/roms/ports and then run them from the "RetroPie" or "Ports" menu in EmulationStation.

              OK that is good advice, but what I was trying to do was a bit different.

              When starting the emulators from the menu, runcommand.sh gives you a few seconds of delay during which you can open the configuration menu, and even cancel if you want. This is good for when you press the wrong button to start a game you did not actually want to start.

              What I wanted to do was to make it so you can wrap any arbitrary command as a parameter to runcommand.sh which would give you a few seconds of delay with that config menu to grant the option to cancel running that arbitrary command.

              S 1 Reply Last reply Reply Quote -1
              • S
                sleve_mcdichael @BenMcLean
                last edited by sleve_mcdichael

                @benmclean said in runcommand.sh should run commands:

                What I wanted to do was to make it so you can wrap any arbitrary command as a parameter to runcommand.sh which would give you a few seconds of delay with that config menu to grant the option to cancel running that arbitrary command.

                Okay, and these don't use the runcommand launch dialog because they don't use runcommand.sh; "RetroPie" menu uses retropie_packages.sh and "Ports" menu just uses bash %ROM%.

                It might work if you add a new system platform: "Scripts."

                Start by adding the system to your ~/.emulationstation/es_systrms.cfg file (if the file does not exist, copy it from /etc/emulationstation/es_systems.cfg; custom edits must be made in ~/.emulationstation because the one in /etc gets overwritten periodically.) Copy an existing entry and change everything to "scripts." Make .sh .SH the extensions. You don't need a "platform" for scraping box art. "Theme" is optional, and requires a compatible system theme to do anything:

                  <system>
                    <name>scripts</name>
                    <fullname>Bash Scripts</fullname>
                    <path>/home/pi/RetroPie/roms/scripts</path>
                    <extension>.sh .SH</extension>
                    <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ scripts %ROM%</command>
                    <theme>scripts</theme>
                  </system>
                

                Next you need a config folder for the system. The <command> used tells it to look in $CONFIGDIR/scripts for a file called emulators.cfg so let's make sure it can find them: create the directory/folder /opt/retropie/configs/scripts and inside the directory, make the file /opt/retropie/configs/scripts/emulators.cfg.

                emulators.cfg should have the following text:

                binbash = "bash %ROM%"
                default = "binbash"
                

                Finally, you just need to create the ~/RetroPie/roms/scripts folder and place your .sh scripts in there. If everything works like I think it should, this should use the runcommand.sh launch dialog giving you the option to engage the menu and cancel the launch, or if not, run the script with bash just like the "Ports" menu would.

                Edit: you can add this to any platform's menu by adding .sh .SH to the platform's extensions in es_systems.cfg and adding the binbash = "bash %ROM%" line to its emulators.cfg file. Don't change the default emulator for the platform ; you'll have to use the runcommand dialog once to change the emulator on a per-item basis to use the binbash option.

                1 Reply Last reply Reply Quote 1
                • N
                  navi87
                  last edited by

                  Just add your scripts to the retropie menu, very simple. i never had to make any edits to make it work, just some editing to get the script to have a picture in EmulationStation and description of the script.

                  If you want the scripts to appear within your Ports, you might need to include .sh with the filetypes that are supported with Ports even though from memory it should already be set up like that (i cant double checking this right now, currently making a backup of my SSD)

                  If you can see the scripts in EmulationStation but theyre just not executing after selecting them, then you will need to chmod +x your sh files.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post

                  Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                  Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.