0

I want to create a file which will execute a code, for example:

sleep 60s; dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend

-so that double-clicking on it will be equal to open the terminal and write it in there.

How do I do it?
(In windows, I think, it is a .bat file)

Tzahi Leh
  • 261

1 Answers1

5

In Linux, we use bash (.sh) scripts.

To make a a bash script execute on double click you need to make it executable, and add the line #!/bin/bash to the start.

The file should look like this:

#!/bin/bash
sleep 60s; dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend

Make it executable with:

chmod +x nameofscript.sh

You'll also want to follow this guide.

TellMeWhy
  • 17,484