Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Ranzear
Jul 25, 2013

Bash is a good terminal but a miserable scripting language.

PowerShell is a good scripting language but a miserable terminal.

Trying to do both is the folly.

Adbot
ADBOT LOVES YOU

Xarn
Jun 26, 2015
Since we have powershell defender in here, enlighten us on the usefulness of the curl alias.

redleader
Aug 18, 2005

Engage according to operational parameters

Xarn posted:

Since we have powershell defender in here, enlighten us on the usefulness of the curl alias.


redleader posted:

powershell is endless terrible decisions around one core and good idea - pass structured data instead of text around

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

Xarn posted:

Since we have powershell defender in here, enlighten us on the usefulness of the curl alias.

Ain't nobody defending that and MS finally killed that as a default alias in powershell v6 after years of complaints about it from even the most avid powershell fans.

Edit: Don't mistake people saying "drat I really like this one aspect of powershell over bash and a lot of the complaints about powershell are overblown or outdated" as being enthusiastic endorsement. All shell scripting is pretty lovely and most people put up with it for certain types of tasks because the alternatives are annoying.

Cold on a Cob fucked around with this message at 11:38 on Apr 3, 2023

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

poor shaggar, there's a multi-page powershell flamewar and nobody's seen fit to tap them into the fight

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Dijkstracula posted:

poor shaggar, there's a multi-page powershell flamewar and nobody's seen fit to tap them into the fight

There's a reason no one has mentioned this to Shaggar :ssh:

CPColin
Sep 9, 2003

Big ol' smile.
What is PowerShell's stance on bicycle infrastructure?

Macichne Leainig
Jul 26, 2012

by VG

CPColin posted:

What is PowerShell's stance on bicycle infrastructure?

Did you know that a bikeshed is just as important to the functionality of PowerShell as code itself? Yeah, turns out if you don't have a place to park your bike while you're coding, your brain gets all scrambled and you end up typing gibberish. Trust me, I tried it once and ended up accidentally creating a sentient AI that only communicates in cat memes. So, moral of the story: always make sure you have a bikeshed handy when working with PowerShell.

OddObserver
Apr 3, 2009

CPColin posted:

What is PowerShell's stance on bicycle infrastructure?

Presumably its structured approach leans towards protected bike lanes, while Unix shells' everything-is-the-same approach prefers no separation between cars and bicyclists at all?

(Also, seriously, how everything-is-a-string means that simple comparisons require either quoting or a hack to not blow up on empty strings in sh does belong in this thread...)

FlapYoJacks
Feb 12, 2009
In *nix land, if your scripting needs to go beyond basic string comparisons, you move to Python or Pearl.

Jigsaw
Aug 14, 2008

FlapYoJacks posted:

In *nix land, if your scripting needs to go beyond basic string comparisons, you move to Python or Pearl.

If I can’t walk somewhere, I use a rocket ship.

FlapYoJacks
Feb 12, 2009

Jigsaw posted:

If I can’t walk somewhere, I use a rocket ship.

Yes.

Volte
Oct 4, 2004

woosh woosh

Jigsaw posted:

If I can’t walk somewhere, I use a rocket ship.
What is the middle ground between walking and a rocket ship in this metaphor?

FlapYoJacks
Feb 12, 2009

Volte posted:

What is the middle ground between walking and a rocket ship in this metaphor?

PHP

Beef
Jul 26, 2004
I just incrementally grow my 2 line bash script into a 2kloc monstrosity all the while bemoaning that this should have been a python script.

While I see others building rockets, I'm reporting better progress to management with my tree-climbing technique.

Bongo Bill
Jan 17, 2012

code:

#!/bin/env runhaskell

Falcon2001
Oct 10, 2004

Eat your hamburgers, Apollo.
Pillbug

Beef posted:

I just incrementally grow my 2 line bash script into a 2kloc monstrosity all the while bemoaning that this should have been a python script.

While I see others building rockets, I'm reporting better progress to management with my tree-climbing technique.

This was my current team at work a few years ago and we're finally starting to move poo poo over to Python and it's a huge improvement.

Foxfire_
Nov 8, 2010

FlapYoJacks posted:

In *nix land, if your scripting needs to go beyond basic string comparisons, you move to Python or Pearl.
Almost every non-trivial script is past that point.

"Has an array", "has command line arguments", "a string might be empty", and "want to test a commands exit code" are all past that and places where everything-is-a-string starts sucking

Xarn
Jun 26, 2015
:hai:

QuarkJets
Sep 8, 2008

Jigsaw posted:

If I can’t walk somewhere, I use a rocket ship.

Yeah I would fly around town punching nazis like the Rocketeer if given the chance, absolutely. But using Python is not nearly that cool

lifg
Dec 4, 2000
<this tag left blank>
Muldoon
Perl is less of a rocket ship than a rocket you can strap to your back like the coyote with the same chance of long term success.

bobthenameless
Jun 20, 2005

i think we can all agree that shell scripting isnt real programming anyways, leave that to the janitors

Wipfmetz
Oct 12, 2007

Sitzen ein oder mehrere Wipfe in einer Lore, so kann man sie ueber den Rand der Lore hinausschauen sehen.

QuarkJets posted:

Different find tool; you can open up WSL and use `find /mnt/c/ -name libcef.dll`. This will only search file names
A few pages ago, but: Heyo, thanks, learned something new. I actually didn't knew that and misinterpreted "Bash on your Windows" as Windows' Commandline instead of... "Actual Linux' Bash on your Windows".

QuarkJets
Sep 8, 2008

lifg posted:

Perl is less of a rocket ship than a rocket you can strap to your back like the coyote with the same chance of long term success.

Perl is like strapping a bunch of fireworks to a chair and "launching" yourself into space, like the Chinese legend of Wan Hu

bobthenameless posted:

i think we can all agree that shell scripting isnt real programming anyways, leave that to the janitors

I told a room mate this in college and he got so mad, if you're out there reading this then I'm sorry but it's still true: shell scripting is for chumps and isn't real programming.

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man
it's probably easier to do a typical shell script task (poke around the filesystem, do some stuff with a dynamic set of files you find probably based on arguments that mostly consists of piping output between system programs and transforming the strings or ps objects those system programs return) in bash/ps rather than c/c++/c# but uh that's about the most positive i can say

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

Phobeste posted:

it's probably easier to do a typical shell script task (poke around the filesystem, do some stuff with a dynamic set of files you find probably based on arguments that mostly consists of piping output between system programs and transforming the strings or ps objects those system programs return) in bash/ps rather than c/c++/c# but uh that's about the most positive i can say

In addition I use scripting for scheduled http calls or sql scripts. A lot of services we use have REST apis so I can whip up a script in a few minutes without having to worry about third party dependencies/libraries/etc.

Presto
Nov 22, 2002

Keep calm and Harry on.

Phobeste posted:

it's probably easier to do a typical shell script task (poke around the filesystem, do some stuff with a dynamic set of files you find probably based on arguments that mostly consists of piping output between system programs and transforming the strings or ps objects those system programs return) in bash/ps rather than c/c++/c# but uh that's about the most positive i can say

In the past I have literally written C programs to do some of that poo poo because it was faster than figuring out how to do it in bash.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Ranzear posted:

Bash is a good terminal but a miserable scripting language.

PowerShell is a good scripting language but a miserable terminal.

Trying to do both is the folly.

I think I would have been happier with "C# but you can pipe output into other commands easily" rather than actually have to read documentation about how to invoke functions in powershell because microsoft's manic pixy dream language is special and unique and doesn't invoke functions the way all the other languages do (with parenthesis like god intended).

CPColin
Sep 9, 2003

Big ol' smile.
code:

#!/usr/bin/env kotlin

:smuggo:

Foxfire_
Nov 8, 2010

Bruegels Fuckbooks posted:

because microsoft's manic pixy dream language is special and unique and doesn't invoke functions the way all the other languages do (with parenthesis like god intended).
I have bad news for you about invoking functions in typical unix shells

QuarkJets
Sep 8, 2008

If you're writing a shell function then you should stop and do something else, I mean that in the biggest way, maybe become a forest ranger or something

redleader
Aug 18, 2005

Engage according to operational parameters

Bruegels Fuckbooks posted:

microsoft's manic pixy dream language

:hmmyes:

Falcon2001
Oct 10, 2004

Eat your hamburgers, Apollo.
Pillbug

QuarkJets posted:

If you're writing a shell function then you should stop and do something else, I mean that in the biggest way, maybe become a forest ranger or something

I almost wrote a monstrosity of a weird bash script (I don't know bash at all) that involved a bunch of jq parsing and nested bullshit. I'm so glad I finally went 'wait a loving minute I'm doing this in Python'

Soricidus
Oct 21, 2010
freedom-hating statist shill

CPColin posted:

code:
#!/usr/bin/env java
:smuggo:

ftfy

(I have genuinely used this)

Vanadium
Jan 8, 2005

Falcon2001 posted:

I almost wrote a monstrosity of a weird bash script (I don't know bash at all) that involved a bunch of jq parsing and nested bullshit. I'm so glad I finally went 'wait a loving minute I'm doing this in Python'

I did this all the time at work. Just scripted TLS cert provisioning with a whole bunch of curl and jq and that sort of thing.

Anyway unrelatedly I'm currently looking for a new job after some recent restructuring,

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
The common advice to move to another language when a script gets complicated is not bad advice. But the steadfast refusal to learn the second thing about one's tools continues to be impressive. sh is a mildly esoteric programming language, it's not some impenetrable wall. If you get the vapours at the sight of an at sign, maybe that's on you.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

pokeyman posted:

The common advice to move to another language when a script gets complicated is not bad advice. But the steadfast refusal to learn the second thing about one's tools continues to be impressive. sh is a mildly esoteric programming language, it's not some impenetrable wall. If you get the vapours at the sight of an at sign, maybe that's on you.

There are things that are relatively straightforward to do in bash that are somewhat complicated to do in other languages too. Like having two programs running, each piping their stdout to the others stdin

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
Ouroboro.sh

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Coding Horrors: Ouroboro.sh

Adbot
ADBOT LOVES YOU

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


And don't miss out on this...gem from the C/C++ thread:

Subjunctive posted:

A C++ behaviour that has stumped someone who wrote a time-travelling debugger:

https://twitter.com/rocallahan/status/1643340192034742272

I can’t figure out how to copy from godbolt on my phone, so here’s a screenshot:


  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply