Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Lawrence D'Oliveiro Newsgroups: comp.os.linux.misc Subject: Re: Useless Use Of Regexes Date: Wed, 26 Mar 2025 00:42:08 -0000 (UTC) Organization: A noiseless patient Spider Lines: 25 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 26 Mar 2025 01:42:08 +0100 (CET) Injection-Info: dont-email.me; posting-host="30bc461f20db310b0809141d3331773a"; logging-data="537029"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/EmjU6W9eJIIFxexa5s8rt" User-Agent: Pan/0.162 (Pokrosvk) Cancel-Lock: sha1:fgdwT4WDa4zZJHGjFNOSrZWvywg= Bytes: 2396 On Tue, 25 Mar 2025 13:03:45 +0100, Marc Haber wrote: > This is a classic example why shellscripts are inferior. If you had > written that in python, you could just ingest iproute's output in a > python data structire and access it naturally. > > A very wise German person, today a friend of mine, used to say 25 > years ago: "Verwende perl. Shell will man können, dann aber nicht > verwenden." In English that would be "Use Perl. You want to be able > to use Shell, but then don't use it." Today, of course, that would > be python. There is a certain challenge in seeing how far you can push things in a shell script (or specifically, a bash script), before giving up and switching to Python. For example, figuring out how to deal with arbitrary file names, which might include funny characters like spaces and newlines -- can that be done in bash? Yes it can. But maybe it’s more trouble than it’s worth ... My classic example of a large, yet well-written shell script is the configure script for FFmpeg . It’s over 8000 lines. Obviously it must be handwritten, not generated by GNU Autotools in the traditional way, because you can actually read it and understand what it does.