Force a shell script to run in the terminal

Asked

Viewed 178 times

0

The user will download the script from an internal website and run it. What I wanted was that after downloading the user take two clicks on the script and it runs and not open for editing.

There is a way to force the opening of a script shell in the terminal by the graphical interface?

When I double-click .sh or .run it opens in the text editor.
Rename himself to .bin he says he doesn’t know what to do and asks to look in the program center.

I’ve even compiled it with shc to see if it was executed but it didn’t work. Ideas?

  • I don’t know if I understand you very well, it seems to me that you want to create a kind of shortcut for your .sh, maybe this link will help you vivaolinux.com.br

  • 2

    It depends on the Linux distribution you are using, it is up to you to define the hash bang properly, it depends on you giving permission to run on the computer after downloaded the file. If you want something executable, it’s easier to create one than try to magically execute one script. Anyway the problem does not seem to be programming and probably the question will be closed.

  • I use Debian Stretch but the script will be used in micros with Ubuntu 16.04 or 18.04. I usually use #!/bin/sh but I tested with bash as well and gave in it. I tested on a micro with Ubuntu 16.04 and after downloading the script is already with permission to run. I’m not asking for any magic, I’m just asking if there’s a possibility.

1 answer

1

Depending on the graphical interface, right-clicking and going into properties you can direct to what you want to open by default, similar to what exists in Windows as well.

  • Yes, but in this case you would still have to ask the user to do something other than two clicks. The idea is that the user does nothing but two clicks.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.