1

I'm looking for the absolute easiest way to make some executable scripts for Linux users that are not very experienced. I am breaking my head over this compared to Windows.

Is there any way to create for example a .sh file with some terminal commands that can be executed without using chmod +x first?

What I want to achieve:

  1. User downloads a file
  2. Double clicks it, gives permission
  3. Script runs and installs a couple of things for them and makes a few shortcuts (for example)

So far every solution involves making the user run terminal commands which I want to avoid to keep things as easy as possible.

2
  • 2
    Does it have to be a mouse-friendly solution? A single command can do this. Take a look at the install instructions of Oh my Zsh or Homebrew. Or use an archive which maintains file permissions (.tar or .7z).
    – Melebius
    Sep 10, 2018 at 12:31
  • 4
    Why not create a .deb file? The .deb installation files that Ubuntu uses serve exactly that purpose.
    – vanadium
    Sep 10, 2018 at 12:45

1 Answer 1

3

The best approach to distribute software for Ubuntu would be to package it in a .deb installation file. Upon double-clicking, the Software tool will install the file, and it will as such be registered in the package system of the user. Consequently, the user will also be able to easily uninstall it using Software as well.

Offering the software via a repository, a PPA, is even better. This way, users can automatically be made aware of possible updates to the software and allow installation of the updated version with a single click.

Ideal situation, of course, is where your software is included into the community maintained Ubuntu repositories.

This is of course Ubuntu (and debian derivatives) specific, but Ask Ubuntu is specifically dedicated to Ubuntu. Other "Windows-style" options to distribute scripts and software by having users download and execute them, are not recommended but are still easy to achieve. A user does not need to execute a chmod +x command to make your script executable: the executable bit can be set from any file manager with right-click - Properties. Many file managers would offer to execute the script on double clicking. However, this is changing. To tighten up this unsecure way of working, Gnome Files, for example, no longer launches an executable script on double-click.

2
  • Will the user have to set the permission themselves with right click -> properties or will it remember for shared scripts like putting a script inside a tar.gz?
    – elw
    Sep 12, 2018 at 14:55
  • A .deb is an installation file that automatically will place all files necessary to run the program on the user's system. An installation typically also provides a .desktop file. During installation, that .desktop file is automatically placed in the right location such that the program will appear in the user's desktop menu, so he/she can conveniently find and launch the program. The installer may also set MIME file type associations, such that the program is launched when double-clicking user data files with which the program may work.
    – vanadium
    Sep 12, 2018 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .