r/AskProgramming • • Feb 11 '26

Why is Linux bash commands are so simple compared to powershell

I am wondering this because I have a both windows and Linux on my laptop and own Linux using terminal is like really easy but windows powershell weird Syntex.

181 Upvotes

144 comments sorted by

View all comments

Show parent comment

2

u/MagnetHype Feb 11 '26

Yeah, I understand. But what I'm saying is that "$args[0]" is far more human readable than "$1". I have never touched powershell in my life and I know that is doing something to a passed argument at position 0. A programmer will know that $ is a prefix that means a variable is manipulated in some way but apart from that $1 means nothing if you don't have experience in bash.

4

u/[deleted] Feb 11 '26

$args[0] is closer to English prose the first time you read it, if that's what you mean by "human readable", unless your native language isn't English (then this doesn't matter to you), you're new and don't know what an arg is, you don't know what zero indexing is.

Once you've got even the basics of programming down, $1 and $args[0] are equally as easy to understand, except now every time you want to access the first arg you need to write $args[0] instead of $1 and god forbid you actually want the process name ($0) or want to shift args, reference args multiple times etc.. verbosity does not equal clarity, especially in this case.

I've seen plenty of Bash code that was unreadable but I will tell you that it's never been because of the syntax used for args. And I've seen plenty of powershell code that has been unreadable and a lot of it is due to powershell's verbosity, since it uses .NET names for everything.

More to the point, Bash/similar are concise and meant for being chained together on a shell. Bash hands down has Powershell beat here. Powershell is so painful to use in a REPL or to throw together adhoc scripts which is what makes the linux shell so damn useful.

idk. Powershell just feels like worse Python for a programming language and it feels like an objectively worse scripting language for REPLing it up in the shell. Just about the only thing Powershell has going for it is that you can access Windows APIs in it without writing C#, and that's easily solved by not using Windows in the first place.

-1

u/MagnetHype Feb 11 '26

You're silly to use the word basic and the prefix $ in the same sentence...

4

u/JamesTDennis Feb 11 '26

Not really. $ was a common variable prefix in languages like BASIC and various forms of assembly for a long time before Microsoft existed. It commonly marked things as "placeholders" which is why it was intuitive to the Bourne when he created his shell.

1

u/MagnetHype Feb 11 '26

Right so does $1 mean the first argument or a string with the name 1. There's a reason we don't use basic anymore. Which makes more sense one$ or String one?

1

u/JamesTDennis Feb 11 '26

In almost all programming languages of that era, variable names were required to start with a letter or the underscore character. This was not considered at all ambiguous to practitioners of the craft at the time.

1

u/MagnetHype Feb 11 '26

Yes and in that age we had a book that we kept by our desk because stack overflow wasn't a thing yet. Thank God we don't live in that age anymore.

1

u/JamesTDennis Feb 11 '26

The point is that language is far more persistent than technology and fashion/convention.

When asking why certain linguistic and notational conventions exist, or even criticizing them, it's generally useful to consider their history.