Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (3) </ 1 [2] 3 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Embedding Commands, Like a DOS batch file< Next Oldest | Next Newest >
larkl Offline





Group: Members
Posts: 177
Joined: Sep. 2005
Posted: Sep. 22 2005,15:54 QUOTE

It's pretty easy.  In your text editor, start the file with:

#!/bin/bash

then add whatever you want on the next lines:

#!/bin/bash
mkdir <...> or whatever


save it and make it executable with chmod and you should be good to go.  Have fun!
Back to top
Profile PM 
Patrick Offline





Group: Members
Posts: 333
Joined: Sep. 2004
Posted: Sep. 22 2005,17:54 QUOTE

An other example:

#!/bin/sh
killall -9 wmclockmon
/cdrom/keep/dockable/usr/bin/wmclockmon -tm 1 &
#this batchfile restart wmclockmon

this file (when executed) kills a process (an other executed file) with the name: wmclockmon (a clock ). After that it start the clock

-When there's a # in front of a line, everything in that line is NOT executed
-When there's a & at the end of a line, the command's in that line are executed AND the process moves on to the next line (doesn't wait for the commands in that line to end)
-When there's not a & at the end of the line, the process waits until every command is ready with it's task.
-the first line of a "batch-file" is: #!/bin/sh


Just an example, i hope i got it all right (i am learning just like you)


--------------
Usb-stick sandisk cruzer titanium 512 Mb:
DSL 2.3 (final)
Firefox (Mozilla 1.06)
WM -biff  -cdplay -clockmon -smixer -usic -top -net -biff -ifinfo -cpuload
gps vnc LinNeighborhood (samba) QtParted bdc
xawtv imagemagick xplanet
Back to top
Profile PM WEB 
cbagger01 Offline





Group: Members
Posts: 4264
Joined: Oct. 2003
Posted: Sep. 23 2005,05:00 QUOTE

BASH scripts are a million times more powerful than old DOS BAT files.

If you want to learn more about BASH, here is the place:

http://www.tldp.org/LDP/abs/html/
Back to top
Profile PM 
Aussie Offline





Group: Members
Posts: 17
Joined: Aug. 2005
Posted: Sep. 23 2005,05:17 QUOTE

Hi,

Ok, I created an executable bash file:

#!/bin/bash
mydsl-load /opt/circuslinux.dsl

I saved it as /opt/circus

Typing /opt/circus in a terminal window will add the circus game to mydsl in the context menu, and clicking on it will open and run the game.

However, adding [exec] (Circus) {/opt/circus} to  a submenu in the context menu file still does nothing when I click on that menu item.

Do I have to "call" the bash file somehow in my menu file for it to work?

There is a reason why I'm doing all this, so any help will be appreciated  :)

Aussie
Back to top
Profile PM 
Aussie Offline





Group: Members
Posts: 17
Joined: Aug. 2005
Posted: Sep. 23 2005,06:24 QUOTE

Quote (Aussie @ Sep. 23 2005,13:17)
#!/bin/bash
mydsl-load /opt/circuslinux.dsl

Success!

The mydsl-load command loads the game into /usr/games/

I then have to "call" the game by adding an extra line:

/usr/games/circuslinux

I also have to leave the "&" option out of the first command, to give the system time to load the game before "calling" it.

So my bash file is:

#!/bin/bash
mydsl-load /opt/circuslinux.dsl
/usr/games/circuslinux

Now the link in the context menu works, and the game starts automatically (without adding a mydsl entry in the context menu).

The reason I wanted to do this is to only load applications when I need them, rather than have mydsl load everything at start-up. This saves time and resources.

If I can do the same with other apps such as Office, I assume I'm going to have a very fast and versatile OS that is bulletproof - since it's a frugal install.

We shall see  :)

Aussie
Back to top
Profile PM 
11 replies since Sep. 22 2005,15:13 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (3) </ 1 [2] 3 >/
reply to topic new topic new poll
Quick Reply: Embedding Commands

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code