<div dir="ltr">I haven't done this with bash scripts, but the general idea in the "real" programming world, is to create libraries (files) of related code, and loading that library in the scripts that use them. So, you might have a library for encryption/decryption routines, another library of routines for parsing xml, and yet another for establishing connections to other devices using a particular protocol. So, you won't usually have files with individual routines. They might have dozens of routines in each library. Usually, when you have more than this, there's some naming mechanism that you can use to further subdivide the routines. If you need only one of them, it's still more efficient to load the library (since you only have to do it once, at the beginning of the script), than to create hundreds of script files with one routine each.<div>
<br></div><div>My favorite scripting language is ruby. With it, you can create Modules::Classes::Subclasses (etc) in order to properly namespace routines with a particular functionality. Proper ruby coding would have the programmer create a folder with the name of the module. This module folder would then hold files with the name of the classes that are part of that module. This keeps everything well-organized. I'm not sure how bash programmers do this, but I'd love to hear the conventional wisdom from those of you who have done this for a while.</div>
<div><br></div><div>Doug</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 24, 2013 at 4:16 PM, Wolf Halton <span dir="ltr"><<a href="mailto:wolf.halton@gmail.com" target="_blank">wolf.halton@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I have tended to make little scripts that do one thing or maybe 3 or 4 but then call them with another head script where the user input is set up. or just let people call the little scripts one by one, such as in the case where a little script might take 30 hours to complete, and network conditions can break it. I like coming back in and running the script a second time, first thing in the morning and check what was left out in the overnight run. <br>
<br></div>Of course, I am still a newbie at this.<br></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">Wolf Halton<br><br>--<br>This Apt Has Super Cow Powers - <a href="http://sourcefreedom.com" target="_blank">http://sourcefreedom.com</a><br>
Security in the Cloud - <a href="http://atlantaCloudTech.com" target="_blank">http://AtlantaCloudTech.com</a><br>Apache Developer <a href="mailto:wolfhalton@apache.org" target="_blank">wolfhalton@apache.org</a><br></div>
</div><div><div class="h5">
<br><br><div class="gmail_quote">On Wed, Jul 24, 2013 at 3:09 PM, Jim Kinney <span dir="ltr"><<a href="mailto:jim.kinney@gmail.com" target="_blank">jim.kinney@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">feet first or head first, at some point they just have to jump in. Little files are easier for nubes to follow. <br></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, Jul 24, 2013 at 2:57 PM, leam hall <span dir="ltr"><<a href="mailto:leamhall@gmail.com" target="_blank">leamhall@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Yeah, I used to have the %POST do a wget and grab the latest scripts and then run them. The issue I'm trying to also deal with is to be able to run a select subset of the scripts ad hoc. <br>
<br></div>
One big driver is to make it easier for others to start adding code. One script to rule them all makes it a bit more intimidating. <br><span><font color="#888888"><br>Leam<br></font></span></div><div>
<div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 24, 2013 at 2:48 PM, Jim Kinney <span dir="ltr"><<a href="mailto:jim.kinney@gmail.com" target="_blank">jim.kinney@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Ah. Now I understand what you're doing. In a prior incarnation, we did the DoD security dance with a single script that ran just post install (kickstart called it in %POST) to do the lockdown. The script had comments for each lockdown and a test was run for each to determine if it was needed. Post lock tests were done and all pre and post tests were logged to prove it was done. As this was done before a human touched the machine, the powers that be were happy.<br>
<br></div>So, zillion scriptlets can be merged into monolithic script and PHBs are happy.<br></div><div class="gmail_extra"><div><div><br><br><div class="gmail_quote">On Wed, Jul 24, 2013 at 2:11 PM, leam hall <span dir="ltr"><<a href="mailto:leamhall@gmail.com" target="_blank">leamhall@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>In this case it's less than a couple hundred Bash scripts. Each script deals with a specific task in DoD directives. Thus I can pull the ones our site needs and document why the others won't work. <br>
<br>Or I can bang my head into my desk why duplicating what's already been done...<br><br></div>Leam<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Wed, Jul 24, 2013 at 2:01 PM, Michael B. Trausch <span dir="ltr"><<a href="mailto:mbt@naunetcorp.com" target="_blank">mbt@naunetcorp.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
<div bgcolor="#FFFFFF" text="#000000"><div>
<div>On 07/24/2013 01:50 PM, Jim Kinney
wrote:<br>
</div>
<blockquote type="cite">
<div>That would depend, to me at least, on whether the final
deployment is an internal or external tool. Internal gets the
single blob. External gets a zillion files. The logic is to make
it confusing to the external (l)user so they won't tinker with
things. Bonus points if the zillion files all look like
obfuscated perl :-)<br>
</div>
</blockquote>
<br></div>
Hrm... we need a minification tool for Bash.<br>
<br>
Perl, obviously, doesn't need one. Just remove the whitespace, it's
ugly and cryptic all by itself. :-D<div><br>
<br>
<blockquote type="cite">I saw a system once that had a shell application that
called a zillion files. The customer wanted the development team
to go away but was worried about what all the application did. So
I went over it with a fine tooth comb. Basically, the application
consisted of 4 or 5 main script files that each would call 20-30
of the crap files to do things like count lines and characters but
then dump the results without ever using them. So there was
150-200 scripts that were culled from the process after some
careful refactoring in the 5 main ones. Then I ran into funny
issues that were sort of like race conditions but not quite. The
zillion crap scripts were created to slow down the main scripts so
it was closer to the original system that ran at 300MHz instead of
the now 1.5 GHz. It was using many serial ports to get data from
lab systems. I replaced the lot with a few sleep calls to allow
the serial port data to accumulate and the developers were dumped.</blockquote>
<br></div>
Nice. :-)<br>
<br>
A tool like Closure would actually be really neat for things like
bash, python, perl, etc.<br>
<br>
Well, not Python, since Python actually relies on whitespace for
semantics.<br>
<br>
Of course, if you have a gazillion things that can cause deadlocks
or have race conditions, you absolutely want things in a single
program, even if the work is itself spread over different modules.
Sounds like the perfect thing for C.<div><br>
<br>
— Mike<br>
<br>
<br>
<div>-- <br>
<table border="0">
<tbody>
<tr>
<td> <img src="cid:part1.09060300.02040205@naunetcorp.com" alt="Naunet Corporation Logo"> </td>
<td> Michael B. Trausch<br>
<br>
President, <strong>Naunet Corporation</strong><br>
☎ <a href="tel:%28678%29%20287-0693%20x130" value="+16782870693" target="_blank">(678) 287-0693 x130</a> or <a href="tel:%28888%29%20494-5810%20x130" value="+18884945810" target="_blank">(888) 494-5810 x130</a><br>
<br>
</td>
</tr>
</tbody>
</table>
</div>
</div></div>
<br></div></div><div>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></div></blockquote></div><span><font color="#888888"><br><br clear="all"><br>-- <br><div><a href="http://leamhall.blogspot.com/" target="_blank">Mind on a Mission</a></div>
</font></span></div>
<br>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br></div></div><div>-- <br>James P. Kinney III<br><i><i><i><i><br></i></i></i></i>Every time you stop a school, you will have to build a jail. What you
gain at one end you lose at the other. It's like feeding a dog on his
own tail. It won't fatten the dog.<br>
- Speech 11/23/1900 Mark Twain<br><i><i><i><i><br><a href="http://electjimkinney.org" target="_blank">http://electjimkinney.org</a><br><a href="http://heretothereideas.blogspot.com/" target="_blank">http://heretothereideas.blogspot.com/</a><br>
</i></i></i></i>
</div></div>
<br>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div><a href="http://leamhall.blogspot.com/" target="_blank">Mind on a Mission</a></div>
</div>
</div></div><br>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>-- <br>James P. Kinney III<br><i><i><i><i><br></i></i></i></i>Every time you stop a school, you will have to build a jail. What you
gain at one end you lose at the other. It's like feeding a dog on his
own tail. It won't fatten the dog.<br>
- Speech 11/23/1900 Mark Twain<br><i><i><i><i><br><a href="http://electjimkinney.org" target="_blank">http://electjimkinney.org</a><br><a href="http://heretothereideas.blogspot.com/" target="_blank">http://heretothereideas.blogspot.com/</a><br>
</i></i></i></i>
</div>
</div></div><br>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div><br></div>