FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux General Discussion

 
 
LinkBack Thread Tools
 
Old 10-05-2010, 10:29 PM
Ng Oon-Ee
 
Default Creation of startup scripts

On Wed, 2010-10-06 at 00:22 +0200, Johannes Held wrote:
> "Christian" <christian08@runbox.com>:
> > OK, just want to be sure if I want to create rc scripts I should read up on
> > bash scripting?
> Hehe, that depends! If you need to do really complicated things - yes!
> If you simply want to start some program like you would from shell - no!
>
The shell is bash, anyway....
 
Old 10-05-2010, 10:59 PM
"Christian"
 
Default Creation of startup scripts

Hi,


On 2010-10-06 at 00:22 Johannes Held wrote:

>"Christian" <christian08@runbox.com>:
>> OK, just want to be sure if I want to create rc scripts I should read up
>on
>> bash scripting?
>Hehe, that depends! If you need to do really complicated things - yes!
>If you simply want to start some program like you would from shell - no!
>
>--
>Gruß, Johannes
>http://hehejo.de

I want to start my programs at boot time from /etc/rc.d
OK i will read up on bash scripting then and see what I can come up with!
I just want to understand what certain things mean and if I can leave them out or not when I copy and use other scripts to stat programs.
Christian
 
Old 10-06-2010, 12:59 PM
Jeremiah Dodds
 
Default Creation of startup scripts

On Tue, Oct 5, 2010 at 6:59 PM, Christian <christian08@runbox.com> wrote:

> I want to start my programs at boot time from /etc/rc.d
> OK i will read up on bash scripting then and see what I can come up with!
> I just want to understand what certain things mean and if I can leave them
> out or not when I copy and use other scripts to stat programs.
> Christian
>
>
man bash, and read the existing init scripts. the stuff in arch is, as far
as i've seen, clean and well commented. bash scripting has a lot of quirky
little edge areas though, so it can be hard to ease into. Chapters 7-9 of
http://rute.2038bug.com/rute.html.gz and the whole of
http://tldp.org/LDP/abs/html/ helped me out when I was starting to get into
bash scripting. that was back in 2002 or so, so there may be better
resources available.

oh, and don't expect to read all of the bash man page at once. it's huge,
and filled with all kinds of treasure.

tinker, and don't be afraid to break things! (you may want to make sure you
won't be losing anything hugely important before not fearing breakage ... ).
you'll wake up one day and realize you're the master of your machine, and a
glorious day it will be.
 
Old 10-07-2010, 10:12 PM
"David C. Rankin"
 
Default Creation of startup scripts

On 10/06/2010 07:59 AM, Jeremiah Dodds wrote:

> man bash, and read the existing init scripts. the stuff in arch is, as far
> as i've seen, clean and well commented. bash scripting has a lot of quirky
> little edge areas though, so it can be hard to ease into. Chapters 7-9 of
> http://rute.2038bug.com/rute.html.gz and the whole of
> http://tldp.org/LDP/abs/html/ helped me out when I was starting to get into
> bash scripting. that was back in 2002 or so, so there may be better
> resources available.
>
> oh, and don't expect to read all of the bash man page at once. it's huge,
> and filled with all kinds of treasure.
>
> tinker, and don't be afraid to break things! (you may want to make sure you
> won't be losing anything hugely important before not fearing breakage ... ).
> you'll wake up one day and realize you're the master of your machine, and a
> glorious day it will be.
>

100% agree.

http://tldp.org/LDP/abs/html with its list of examples is probably the finest
BASH reference available.

In the Advanced BASH Scripting-Guide (abs) you will find examples listed at the
end of each section like this:

-----
10.1.2. Further Reference

For more on string manipulation in scripts, refer to Section 10.2 and the
relevant section of the expr command listing.

Script examples:

1. Example 16-9
2. Example 10-9
<snip>
-----

** don't skip the examples

Additionally, another great resource I found was looking/working through
scripts that did something close to what I needed to do. Especially if they are
well commented. (try to comment your scripts for those that will read them to
learn in the future)

BASH has so many amazing tools and tricks, that it is hard to pick a few of the
favorites. Test constructs, loops and arrays for sure, but probably the most
helpful was taking the time to learn parameter substitution and string
manipulation. (how to get what you need out of a long string of text, string
length, index, etc..) BASH is particularly good at being a swiss-army knife on
strings. You will always be faced with variables that hold a sting that contains
lots of information that you only need 1 part of. The BASH parameter and
sub-string capabilities will save you untold grief if you learn them up front. I
particularly like:

http://tldp.org/LDP/abs/html/parameter-substitution.html

and

http://tldp.org/LDP/abs/html/string-manipulation.html

as pages to bookmark, get familiar with, and then go back and learn (I haven't
used the 'expr ..' functions much, but everything else is a must). Also, keep
the quick reference handy:

http://tldp.org/LDP/abs/html/refcards.html


Good luck!

--
David C. Rankin, J.D.,P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com
 

Thread Tools




All times are GMT. The time now is 07:47 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org