Scripting problem
Paul Pathiakis
pathiaki2 at yahoo.com
Mon Oct 9 12:46:48 UTC 2017
Quoting is sh's biggest weakness. Well, that and lack of basic data
structures, and the weak logical structures, and so on.
### Well, yes and no. I consider it both a strength and a weakness. I find sh to be exactly what I think of a scripting language to be... glue. I don't expect to write a fully versed program in sh. I wouldn't be using sh for that. I find sh to be that 'tool' to use when I want to call other tools and utilities. (sed, awk, tr, etc)
### I think people have gone way too far in creating 'scripting' languages that are more programming languages than scripting.... Personally, I tried learning PERL which tries to be everything to regex. The problem? Lack of coherence... "I can do this 5 different ways in PERL" Is that supposed to be a good thing when all five seem to execute at different speeds, using different resources, etc? (apologies to Larry Wall and the rest)
### Again, this comes back to "Cathedral and Bazaar".... just because you can deviate from proven practices and procedures to do something 'creative' or 'different' is not necessarily a good thing. In fact, it can be a detriment. Bourne shell continues to live a very healthy life. PERL seems to be dying and there's a huge amount of code around written by people who didn't know the reasons behind using one tool or another and really didn't understand software engineering, how to write a proper program, execution times, etc. (Everyone I come in contact with... I preach 'portability'. Sh runs everywhere and is POSIX. BASH is a superset and using it's extended features can make it non-portable and BASH is not the default everywhere. If I take a Bash script and try to run it under sh... it breaks most of the time. I have only had 1-2 times where a bourne shell would not run under BASH.
Someone once said that if a script is longer than twenty lines or so, it
probably ought to be done in a real scripting langugage. That was me,
but Stephen Bourne has also said it. Yes, that Stephen Bourne.
### I'll go off a little on this with kind of a corollary.... No sh script should be more than 20 lines, however, I typically will call shell scripts from other scripts. But I do agree, if you want to program, use a programming language. (IMHO, C is still the best, most powerful language around but, again, read a book, talk to the people who are in the know - My 'C' guru is a guy who has written code that utterly shocked me in its elegance, execution, and simplicity - and the occasional "You can do something like that in C?" thoughts running through my head.)
#### and, again, this is just my very humble opinion. I'm not a great programmer, but I know a little C and sh....
_______________________________________________
freebsd-questions at freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
More information about the freebsd-questions
mailing list