<html><head></head><body>I've written shell scripts that had functions longer than 100 lines. :-)<br><br>I could care less what it's written in as long as it does what is required or I can whack it with a keyboard until it does.<br><br>My real bash limit is based on quotes. Escaping quotes more than 2 layers deep in code being run by for i in $(seq 1 225): do ssh user@host$i '<long string of  bash code here>' ; done method is where I explode. awk really hates escaped quotes on Tuesdays and Fridays, sed hates them on Wednesdays and every third Monday. I hate them at all times of the day and night.<br><br><div class="gmail_quote">On April 27, 2021 2:29:25 PM EDT, Charles Shapiro via Ale <ale@ale.org> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr"><div>My rule of thumb is about 100 lines.  After that, I reach for a language with better organizational tools.  Python, C++, and lua come to mind first.   Data which is more than around the same amount should go into a database, preferably postgresql.  Spreadsheets are Not Databases.  <br></div><div><br></div><div>-- CHS<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 27, 2021 at 12:08 PM Chuck Payne via Ale <<a href="mailto:ale@ale.org">ale@ale.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">So I use to have a big bash script for setup up. I have since broke it out to small scripts, for things that I can't do with Ansible. <div><br></div><div>To me, smaller scripts make sense because you can troubleshoot issues easier. <br><br>The question is this, does it make sense for you to pull out a function to be on its own? Then yes, small is better, and you can use that script for other things. Does the script need to call on everything or can you make outside calls? </div><div><br></div><div>In your current script, do you have l exit 0 at the end so you know everything rn smoothly? Do you have like different exit number to should you were your script is failing? </div><div><br></div><div>I will be honest, why I am moving more script to ansible if I can use ansible to replace. For things I can't, I try again for the smaller script so I can trouble shoot. I had one script that was 1300 lines of code. It was a mess even with comments to see where issues were. </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 27, 2021 at 11:33 AM Allen Beddingfield via Ale <<a href="mailto:ale@ale.org" target="_blank">ale@ale.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Microsoft Teams even works surprisingly well on Linux these days.  It is our mandated internal communication method, remote work, meeting, collaboration, etc... software at work.  I thought I wasn't going to like it, but on openSUSE Leap it works fine.  Our past year of remote work would have been a lot more difficult without it.<br>
<br>
--<br>
Allen Beddingfield<br>
Systems Engineer<br>
Office of Information Technology<br>
The University of Alabama<br>
Office 205-348-2251<br>
<a href="mailto:allen@ua.edu" target="_blank">allen@ua.edu</a><br>
<br>
<br>
________________________________________<br>
From: Ale <<a href="mailto:ale-bounces@ale.org" target="_blank">ale-bounces@ale.org</a>> on behalf of Adrya Stembridge via Ale <<a href="mailto:ale@ale.org" target="_blank">ale@ale.org</a>><br>
Sent: Tuesday, April 27, 2021 10:21 AM<br>
To: Atlanta Linux Enthusiasts<br>
Cc: Adrya Stembridge<br>
Subject: [EXTERNAL] Re: [ale] Bash Scripts: When to break them into files<br>
<br>
Zoom works perfectly on my debian based systems.<br>
<br>
On Tue, Apr 27, 2021 at 11:18 AM Steve Litt via Ale <<a href="mailto:ale@ale.org" target="_blank">ale@ale.org</a><mailto:<a href="mailto:ale@ale.org" target="_blank">ale@ale.org</a>>> wrote:<br>
How about the more universally Linux-accessible Jitsi instead of Zoom?<br>
<br>
SteveT<br>
<br>
<br>
Michael Potter via Ale said on Tue, 27 Apr 2021 09:49:06 -0400<br>
<br>
>We can have a zoom meeting sometime and I can do my bash presentation<br>
>if there is interest.<br>
><br>
>On Tue, Apr 27, 2021 at 8:04 AM Jim Kinney via Ale <<a href="mailto:ale@ale.org" target="_blank">ale@ale.org</a><mailto:<a href="mailto:ale@ale.org" target="_blank">ale@ale.org</a>>> wrote:<br>
><br>
>> If a chunk of a script is useful by itself, I'll make it it's own<br>
>> file and just call it. I'm not concerned about efficiency of<br>
>> resources so calling a subshell for an external script is not a<br>
>> concern. Grep, sed, and awk are often launched many, many times in<br>
>> sequence anyway so what's another 10-40 subshells? :-)<br>
>><br>
>> An example:<br>
>><br>
>> I have one script that gathers the names of all nodes in the<br>
>> cluster. That can be called as input to push config changes or pull<br>
>> current settings or data.<br>
>> The multi-cluster version calls the same named script as above for<br>
>> each cluster, gathered using different, cluster-specific methods, to<br>
>> perform operations across all nodes in all clusters.<br>
>> There are several, tiny, modifier scripts that can be selectively<br>
>> piped through for queue and node, node only, or queue only selection.<br>
>><br>
>> The modifier scripts were split out so I can reuse that<br>
>> functionality in the myriad ad hoc scripts I write daily for poke,<br>
>> prod, and general break-fix operations.<br>
>><br>
>> On April 26, 2021 10:11:43 PM EDT, David Jackson via Ale<br>
>> <<a href="mailto:ale@ale.org" target="_blank">ale@ale.org</a><mailto:<a href="mailto:ale@ale.org" target="_blank">ale@ale.org</a>>> wrote:<br>
>>><br>
>>> Hey Everyone,<br>
>>><br>
>>> When do you guys feel that your bash scripts have gotten too long?<br>
>>> When do they need to be broken out into individual files, and when<br>
>>> does doing so make them less easy to maintain or follow?<br>
>>><br>
>>> Also, how do you organize your scripts so they are easy for<br>
>>> newcomers to understand?<br>
>>><br>
>>> Your thoughts are appreciated!<br>
>>><br>
>>> Thanks!<br>
>>> Dave<br>
>>><br>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><mailto:<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a>><br>
<a href="https://mail.ale.org/mailman/listinfo/ale" rel="noreferrer" target="_blank">https://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="https://mail.ale.org/mailman/listinfo/ale" rel="noreferrer" target="_blank">https://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr">Terror PUP a.k.a<br>Chuck "PUP" Payne<br>-----------------------------------------<br>Discover it! Enjoy it! Share it! openSUSE Linux.<br>-----------------------------------------<br>openSUSE -- Terrorpup<br>openSUSE Ambassador/openSUSE Member<br>skype,twiiter,identica,friendfeed -- terrorpup<br>freenode(irc) --terrorpup/lupinstein<br>Register Linux Userid: 155363<br> <br>openSUSE Community Member since 2008. </div></div></div></div>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="https://mail.ale.org/mailman/listinfo/ale" rel="noreferrer" target="_blank">https://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" rel="noreferrer" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</blockquote></div>
</blockquote></div><br>-- <br>Computers amplify human error<br>Super computers are really cool</body></html>