Programming and Scripting :: Embedding Commands



Hi,
I am wondering if there is a way to execute commands from a file - as you do in DOS with a batch file?

For instance, the command "mydsl-load opt/snake.dsl" will do the same as going into emelfm, going to the dsl package and clicking Mydsl.

It would be nice to be able to embed this command into a submenu in the "Right click context menu" file for example.

Aussie

Have you tried something like a bash script?  This should be easy.  I'm sure that you could then make it run from an icon.  As far as embedding into a right-click menu, I don't have a clue.
Yes....this is in my opinion the most fundamental feature of a GNU system.  The Bash shell is your base in DSL.  When you log in, you have a shell that opens other shells that open other shells, etc....and they can, for the most part, all be manipulated through bash.  Bash can be used interactively, as from a terminal prompt, and can also be used through a script (the equivalent of a batch file). The mydsl-load executable, and all other DSL-specific executables, are scripts...many of them Bash scripts. Check out the bash documentation at tldp.org for more info.

As far as "embedding" a command in the right-click menu, it should be very easy, depending on what application you are referring to.  In Fluxbox, the file is /home/dsl/.fluxbox/menu.  The syntax is [exec] (LABEL) {COMMAND}.  In Emelfm i think you have a gui interface for manipulating menus and commands.

Hi Larkl,

Putting it into the menu I can do, it's the actual embedding of a command into a file (so it executes) that I don't know how to do.

I don't know what a bash script is yet.

Aussie

Quote (mikshaw @ Sep. 22 2005,23:38)
As far as "embedding" a command in the right-click menu, it should be very easy, depending on what application you are referring to.  In Fluxbox, the file is /home/dsl/.fluxbox/menu.  The syntax is [exec] (LABEL) {COMMAND}.

Hi Mikshaw,

I tried putting the command straight into the menu file using the format you suggested, but it didn't execute. That's why I'm asking about "embedding" commands.

I tried other commands such as "touch" and they won't execute either.

I will have to read up on bash scripts tomorrow, sounds interesting  :)

Aussie

Next Page...
original here.