Message-ID: <69b33726@news.ausics.net> From: not@telling.you.invalid (Computer Nerd Kev) Subject: Re: Over-Elaborate Shell Scripting Newsgroups: comp.unix.shell,comp.os.linux.misc References: <10otpi4$1opu8$3@dont-email.me> <10otrqi$1p9ft$1@dont-email.me> <10ou2q9$1qp29$1@dont-email.me> <10oucet$vo4d$2@news.xmission.com> <10ouhk5$22anv$1@dont-email.me> <20260312095816.00001163@gmail.com> User-Agent: tin/2.6.5-20251224 ("Glenury") (Linux/2.4.31 (i586)) NNTP-Posting-Host: news.ausics.net Date: 13 Mar 2026 07:59:02 +1000 Organization: Ausics - https://newsgroups.ausics.net Lines: 38 X-Complaints: abuse@ausics.net Path: csiph.com!news.bbs.nz!news.ausics.net!not-for-mail Xref: csiph.com comp.unix.shell:26669 comp.os.linux.misc:82901 In comp.os.linux.misc John Ames wrote: > On Thu, 12 Mar 2026 14:12:21 +0000 > The Natural Philosopher wrote: >> Perhaps that is why I never ever shell script if at all avoidable. >> Like Regexp, and PERL it seems to be the province of wannabe gurus >> who cant code C. > > Horses for courses. C is much more capable for general-purpose work, > but it requires a lot more wrangling (or an external library) to do > batch file operations effectively. > > F'rexample, I'm in the process of putting together a home-grown "static > site generator" for use with a free host that doesn't allow server-side > stuff like PHP; the job is to assemble complete HTML files for each > page from header/sidebar templates and page-specific content files. I've done the same thing using PHP, running the script from the command-line to generate the static site. I've done it in Bash earlier too, but I ran into things that are just much easier in PHP since it's built for generating HTML. > It's totally possible to do that in C, but I'd have to either roll my > own code or pull in non-stdlib dependencies for stuff like enumerating/ > looping over the files in a directory; shell script makes that a first- > class language feature. And the core of the work (tacking files to each > other) is likewise something that's easily doable in C, but provided out > of the box in the shell (it's just what cat is designed and named for.) I have seen a static site generator written in C, but I don't think it was anyone's idea of elegance. A C program that only needs to run once (for its author, at least) can cut a _lot_ of corners! I am sometimes tempted to use C for dynamic sites, though many claim PHP is just as fast these days anyway. -- __ __ #_ < |\| |< _#