6 ms·
I can't seem to convince myself to use Perl anymore for serious applications, but I do still whip it out occasionally for essentially the "shell scripts with sa
by dgunay 3y ago
I can't seem to convince myself to use Perl anymore for serious applications, but I do still whip it out occasionally for essentially the "shell scripts with sane control flow" use case.
IMO it is still mostly unmatched in that area. Most other languages, while just as capable, require far more line noise to interact with streams and use regexes. I admit though I have studiously avoided learning awk and sed over the years.
- juanse 3y agoI do exactly that but with ruby
- doubled112 3y agoI don't think I have ruby on any system I administer, but perl is almost always there.
- ElectricalUnion 3y agodpkg requires perl, so perl is around .deb systems even if perl itself is not directly used.
- deleted 3y ago[deleted]
- jrochkind1 3y agoRuby works great for this, but is unfortuantely not installed on many systems -- but this isn't just bad luck, I think it's a consequence of the fact that ruby code written two years ago has a pretty good chance of not running on the recent version; and code written for the recent version without thinking about backwards compat also has a good chance of not running on ruby of two years ago... Means as a language it's not suitable for "have it installed on every system and then just throw code at it that will work, and keep working" like Perl. Even if you could convince all the distro maintainers to include it, you'd never have the version you want/need. Which would be different for different scripts, and you'd have to be constantly updating all your routine maintenance scripts you just wanted to put there and have them keep working -- which with Perl you could. I wish ruby were more about backwards and forwards compat, but it isn't.
- rektide 3y agoI've had a good time using zx (and some Deno takes on it). It's amazing how little is needed to make JS pretty handy for scripting. https://github.com/google/zx https://github.com/google/zx I'd love some day to have the power-shelly dream of an object oriented platform. But I don't want to renounce all the cli tools I know & love & switch to a strange new platform to get it.
- actionfromafar 3y agoIf only power-shell was a better shell. How do you start a cli program which is not in PATH? Good luck.
- jodrellblank 3y agoYou write the path to it, relative or full, just like in other shells c:\temp\program.exe
- actionfromafar 3y agoNow try it with a path which contains whitespace.
- alyandon 3y agoFor those that are genuinely curious, & "C:\Program Files\Vendor\AwesomeVendorProgram.exe" (yes - PS is definitely chock full of idiosyncrasies)
- mgkimsal 3y ago"c:\program files\my user name\foo bar baz.exe" ??? tab completion generally works on space-filled path/names too, at least in the last 10 years or so, when working in windows worlds.
- alyandon 3y agoPS interprets that as a string and echoes it. PS C:\Users\me> "C:\Program Files\PuTTY\plink.exe" C:\Program Files\PuTTY\plink.exe
- JeremyNT 3y agoThis is the way I still (occasionally) use perl. I used it back in the CGI days, but even to this day it's excellent for regex-type operations (even just called as a one-liner in a bash script). I learned enough awk to get by, but if you actually want to do advanced processing it can be even more inscrutable than perl, which can do everything awk can and a lot more.