LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-28-2019, 08:49 PM   #16
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware, Proxmox, Debian, CentOS, Ubuntu
Posts: 1,212

Original Poster
Rep: Reputation: Disabled

Quote:
it was fun to play around with scripting again
I have hundreds of shell scripts like this. Many scripts started with a simple idea, often a single command, and evolved into something enjoyable.
 
Old 09-29-2019, 04:06 AM   #17
Mark Pettit
Member
 
Registered: Dec 2008
Location: Cape Town, South Africa
Distribution: Slackware 14.2 64 Multi-Lib
Posts: 533

Rep: Reputation: 212Reputation: 212Reputation: 212
Quote:
Originally Posted by upnort View Post
I have hundreds of shell scripts like this. Many scripts started with a simple idea, often a single command, and evolved into something enjoyable.
I've been a professional developer for the last 36 years - the most recent 28 of those being in a pure Unix environment (Solaris and Linux). Your point above is absolutely TRUE and sadly is the cause of a LOT of bad program design. Over the years we (my company and colleagues) sort of morphed into a view of "if it's less than 10 lines, use bash/ksh, over that Perl till about 30-50 lines, after that it MUST be in Python". But in reality, what we really should have just done was to say : Do it in Python irrespective. Period. I do not (now) believe it's possibly to write any form of sustainable code in bash/ksh/etc - it's just too finicky. Perl is essentially read-only - No-one wants to revisit old Perl code. You have to try really hard to write bad code in Python.

Last edited by Mark Pettit; 09-29-2019 at 04:08 AM. Reason: Spell error
 
Old 09-29-2019, 10:24 AM   #18
0XBF
Member
 
Registered: Nov 2018
Location: Winnipeg
Distribution: Slackware
Posts: 62

Rep: Reputation: Disabled
Quote:
Originally Posted by upnort View Post
I have hundreds of shell scripts like this. Many scripts started with a simple idea, often a single command, and evolved into something enjoyable.
Not quite at that many yet! Mostly I've written shorter ones for batch processing files. However, the most complex is one that automatically generates electronics test papers in latex, using randomization to generate unique questions/circuits and automatic answer key generation. Won't be see that one here though since its a beast.

Quote:
Originally Posted by Mark Pettit View Post
I've been a professional developer for the last 36 years - the most recent 28 of those being in a pure Unix environment (Solaris and Linux). Your point above is absolutely TRUE and sadly is the cause of a LOT of bad program design. Over the years we (my company and colleagues) sort of morphed into a view of "if it's less than 10 lines, use bash/ksh, over that Perl till about 30-50 lines, after that it MUST be in Python". But in reality, what we really should have just done was to say : Do it in Python irrespective. Period. I do not (now) believe it's possibly to write any form of sustainable code in bash/ksh/etc - it's just too finicky. Perl is essentially read-only - No-one wants to revisit old Perl code. You have to try really hard to write bad code in Python.
At just over 100 lines after pulling the comments out I guess you would say I should have used python. I agree it is finicky using bash scripts, especially to share with other people since you have to worry about more contingencies. In this particular case it seemed pretty manageable and I'm not making this as some official product or anything to support long term.

Part of the value in using bash (at least for myself) is that forces me to learn more about the command line tools that are on my linux/slackware system. Some of this stuff I would never have bothered to look at if I went with an already existing program.
 
Old 09-29-2019, 11:55 AM   #19
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware, Proxmox, Debian, CentOS, Ubuntu
Posts: 1,212

Original Poster
Rep: Reputation: Disabled
Quote:
You have to try really hard to write bad code in Python.
Learning Python has been on my to do list for too many years. My biggest challenge is Ben Franklin's "necessity." With my shell scripts there was always a necessity, hence the invention. I was attracted to shell scripting almost the moment I started exploring Linux systems some 18 years ago. No such "necessity" with Python.

Likewise with perl. I need to find a need....

Quote:
At just over 100 lines after pulling the comments out I guess you would say I should have used python.
I never found the line limit argument convincing. Some of my shell scripts are more than 1000 lines. They perform well and are responsive. Some of my shell scripts are extensively commented and I never noticed any sluggishness caused by the comments.

But this is a big world. Plenty of room for different opinions and comfort zones.
 
Old 09-29-2019, 12:21 PM   #20
0XBF
Member
 
Registered: Nov 2018
Location: Winnipeg
Distribution: Slackware
Posts: 62

Rep: Reputation: Disabled
Quote:
Originally Posted by upnort View Post
I never found the line limit argument convincing. Some of my shell scripts are more than 1000 lines. They perform well and are responsive. Some of my shell scripts are extensively commented and I never noticed any sluggishness caused by the comments.

But this is a big world. Plenty of room for different opinions and comfort zones.

I don't have an arbitrary limit either, and I think 10 lines is too low when I know I can finish an idea with a few more lines of bash.

My other option is using c and my experience with that mostly comes from programming embedded systems so I'm not quite up to speed with it in the application world. I only have a few programs done with that. It'd be nice to pick up some other programming languages, if I had the time
 
Old 10-03-2019, 12:02 PM   #21
ttk
Member
 
Registered: May 2012
Location: Sebastopol, CA
Distribution: Slackware64
Posts: 878
Blog Entries: 27

Rep: Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225Reputation: 1225
I've written large projects (hundreds of thousands of lines of code) in both perl and python. They're both well-suited to large projects, if one uses good design methodologies -- encapsulate to interfaces, isolate concerns, use well thought-out hierarchies of classes, and make good use of the wealth of existing libraries (both CPAN and PyPi have over a quarter-million libraries now, ranging from tiny simple solutions to extensive complex frameworks).

Python has definitely grown more popular while perl's heyday is behind it, but which to use is still mostly a matter of personal preference. Perl handily outperforms python at most things, but both are quite slow compared to the static languages, and both can be optimized by rewriting a program's critical path in C.

I've been learning D lately, and liking it rather a lot. It offers high practical expressiveness (about midway between C's low expressiveness and python's/perl's very high expressiveness) and C-like performance, glueless C library integration, and good support for casual parallelism. It can almost be used to write bash-like scripts, but is awkward for that niche compared to perl. It's a good fit for projects which need C-like memory footprint and run-time performance while still allowing the programmer to express a lot of work in just a few statements.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
uptime monitoring tool uks Linux - Networking 4 09-19-2016 11:19 AM
isp uptime monitoring? glorsplitz Linux - Networking 3 04-18-2016 11:22 AM
init uptime longer than system uptime? m4rtin Linux - Server 1 09-15-2010 07:45 AM
Uptime monitoring - best way to perform regular checks yorkshiresteve Linux - Networking 1 01-26-2009 09:30 AM
Simple Network Monitoring (Uptime) drhiii Linux - Networking 1 06-14-2007 07:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration