4

I am wondering if it is possible to run a command without keyboard.

Actually, I would like to run dmesg and save the output into a text file. I have written previously a bash script which does the job, and without keyboard I can log in to the Guest account, but I cannot run the script. Even if I make it executable, it doesn't run if I double-click on it.

So, is there a way to run a command or a script without using keyboard?

1 Answers1

1

Yeah, you need a .desktop launcher. This will run on double click (but needs to be made executable first).

[Desktop Entry]
Version=1.0
Name=Scripttorun
Comment=My Script
Exec=command-goes-here #or /path/to/script.sh
Icon=/path/to/icon/if/you/want
Terminal=false # change to true to see the output
Type=Application

Kudos Javier Rivera, with this answer

Or alternatively:

Your script possibly is running. Just not in a terminal (I'm not sure about this, I may be wrong. Have a look in system-monitor, to see if the script name is there. It is for me.)

Suppose this is your script:

#/bin/bash

command-to-execute-which-has-output

try this instead:

#/bin/bash

gnome-terminal -e "command-to-execute-which-has-output"

that will open it in a terminal when you double click.

Tim
  • 33,500