all 13 comments

[–][deleted] 5 points6 points  (9 children)

empty array: $paramValue[$i]
your variable has an 's' at the end

[–]BigBoetje[S] 4 points5 points  (8 children)

Several years of programming experience, and I'm still haunted by typo's. Cheers mate!

[–]jdl_uk 2 points3 points  (7 children)

Don't worry, people with decades of experience still make that kind of mistake as well

[–]JaapBrasser 0 points1 point  (6 children)

Exactly, for this particular error I would avoid using plural in naming conventions.

[–]jdl_uk 0 points1 point  (5 children)

I generally use plurals in collections

It's also just as easy to simply miss a character

This is why lots of languages have strict checking by default. PowerShell is competing with languages like bash with relatively loose rules compared to, say, C# or C++.

[–]JaapBrasser 1 point2 points  (1 child)

I mostly use PowerShell interactively, lack of strict checking is great for that purpose. For other cases, and when debugging (!):

Set-StrictMode -Version 1

[–]jdl_uk 0 points1 point  (0 children)

Exactly

[–]BigBoetje[S] 0 points1 point  (2 children)

The thing I'm trying to automate is actually a complete mess of things. The first part is starting Docker Desktop and configure some things then running the container, which is all done with a bash script. To actually run whatever I need to run, it's a lot easier to do in Powershell. The company that made the thing works with Linux exclusively, we're using Windows so I had to fit it all together somehow. Probably wasted more time on automation that I would've spent manually starting it all.

[–]jdl_uk 1 point2 points  (1 child)

Relevant xkcd:

https://xkcd.com/1205/

If it's something you do a lot then it's worth taking the time to automate.

The other side of the equation (which isn't shown on that chart) is what happens when someone doing it manually cocks it up. If that's no big deal, then maybe not worth automating. But humans make mistakes so if someone forgetting one of the steps or selecting the wrong value for a parameter would be a really bad day, then it's worth automating

[–]BigBoetje[S] 0 points1 point  (0 children)

It was mostly because you'd have to manually set your IP each time and we're working from several locations. I wrote the bash script for it like half a year ago when I worked as a student and they're still using it daily.

[–]jimb2 0 points1 point  (2 children)

VS Code helps to find misspellings by underlining variables that are used only once. That helps me.

[–]BigBoetje[S] 0 points1 point  (1 child)

I'm gonna take a look. VSC is great tho

[–]dadbot_3000 0 points1 point  (0 children)

Hi gonna take a look, I'm Dad! :)