Why I Love Powershell
PowerShell, a better shell, after 30 years of unix crap
Here's reasons why PowerShell is a magnitude better than bash + unix util bags.
consistent command names
PowerShell has proper command names. Names are full and meaningful. Example:
Get-ChildItem
(ls
)Select-String
(grep
)New-Item
(touch
,mkdir
)Get-Content
(cat
)Compare-Object
(diff
)Get-Help
(man
)
they follow a verb-noun design. I don't like it, but at least it's consistent.
systematic alias and name completion
PowerShell has systematic alias and name completion. Completion works for parameter names too. For example: Get-ChildItem
has abbrev dir
and ls
and gci
. [see PowerShell: List of Aliases]
consistent syntax and parameter names and semantic
PowerShell has consistent syntax and parameter names and semantic, of their order, position, default values, for ALL commands.
For example, -recurse
has the same meaning for every command, and every command that recurses has that option. Similar for -path
, -LiteralPath
, handing path expansion in a universal way. Boolean parameters are handled consistently.
Unlike the unix situation with wild optional syntax and semantics. [see Unix Pipe as Functional Language]
superb documentation
PowerShell documentation is superb, well written, consistent format, with plenty code examples. I'd rate PowerShell doc to be one of the best in computing. Of the 10 programing language plus tens of programing tool docs of past 30 years i've read, i'd rank PowerShell's document to be among top 5 best. unix man page is the extreme opposite, ranks the worst. [see Doc by Dummies]
typed system of values
PowerShell has formalized data types and pipe. It's not just string. PowerShell deal with objects, with full programing language system the dot NET backbone. Numbers, string, and other argument values, expression, all have proper type, and object with methods. You can annotate types when writing a function that prevents many errors.
general computation, not just text processing
PowerShell commands are more general. For example: Get-ChildItem
is not just for listing directory, but for listing any list and tree structures. For example, registry, environment variables.
PowerShell is now cross-platform since 2016. Works on linux and macOS too.
See:
Why Bash Sucks
Bash sucks donkey ass. Bash is 30 years old baggage.
- Syntax soup. E.g. For printing version, you have these variations:
-v
,-V
,-version
,--version
. Sometimes options can be combined, sometimes not. Some option takes a argument, with many different syntax, some arg separated by space, some require equal sign. Order of options may or may not matter. Many options effect other options in complex way. [see Unix Pipe as Functional Language] - Semantic noodle. E.g. Some command has recursive option
-r
, others requires callingfind
,xargs
. - Randomish and cryptic command names. Part of which are juvenile humor.
ls
,cat
,xargs
,pwd
,sed
,awk
,grep
,du
,file
,type
,uname
,df
,diff
,ps
,top
,head
,tail
,id
,with
,who
,wc
,fsck
. - Cryptic and counter-intuitive error code. Success signal is 0. Error is a octal number. Often, you are forced to check the exit code.
- Some command are part of the shell as function, some are independent tools. E.g.
ls
,kill
,ps
. Try to find if they are part of bash. And if so, is bash calling it or the independent command. - Terrible docs. Man page. Incomprehensible. Almost no examples of usage.
- 30 years of baggage. E.g.
tar xvf
(no dash),ps -ef
vsps auwx
- Sea of islands. Each command or tool is written on its own. No coherence. Grep, sed, awk.
Programing Language Design
- Ontology of Programing Languages
- A Class of Programing Languages: Math Languages
- Why I Hate Exceptions
- Iterator, Enumerator, Abstraction Went Wrong
- Should Array Index Start at 0 or 1?
- Syntactic Semantic Difference of Map
- Should Map f Specify Order?
- Function Dependency
- Why I Hate C
- Why I Love Golang
- Why I Love Powershell
- The Complexity of Java Access Specifiers