Linux-Noob Forums

Full Version: How things are done, using bash to run simple command(s)?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Good morning fine people of the Linux world.

Please, forgive me if I have posted this in the wrong section.  Was not sure where to post.
This is just query. After a bit of searching about, I found a solution to something I was looking to achieve, which was to switch my monitor off by clicking on a shortcut/icon,  so that at 3am when Im done watching whatever and Im half asleep, I dont have to reach over and switch the monitor off as one would usually do. 

My solution, a fairly simple one.  A bash script consisting of the following two lines.

#!/bin/bash
sleep 1 && xset dpms force off


Well my primitive understanding is that bash is a simple programming language, which seems rather overkill simply to run a terminal command from a shortcut.  So my question is just about the way in which things are done.......have I reached the typical solution for such a desired result, or are there easier, more basic methods, to run terminal commands on demand/from shortcut, than to use bash


In Win, the typical solution would be a batch file, that is simply a list of commands to be ran.......and whilst my bash script is essentially the same thing, you are STILL having to elicit the use of programming language to do so.  I just cant imagine theres not a lower level way of getting such a simple job done?

Hope you dont mind me asking such a dumb question.  Thank you
Ross