A correction I have to make regarding the Powershell and wildcards. The bash shell is still better though.

I need to correct what I said in this posting: http://www.securitronlinux.com/bejiitaswrath/bash-shell-is-better-than-powershell-and-discussion-of-the-linux-desktop-versus-windows/ and also this one. regarding the Powershell and its handling of certain constructs that I mentioned in this posting: http://www.securitronlinux.com/bejiitaswrath/windows-powershell-not-as-good-as-bash-shell-and-other-thoughts/. It turns out that the Powershell does support this after all as shown in this sample below.

PS C:\Users\Homer\Documents> ls STRIFE[0-9].wad

    Directory: C:\Users\Homer\Documents

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        23/05/1996     18:03   28377364 STRIFE1.WAD

This is how you perform a search as if you were using grep. This does actually work quite well in Windows but Linux has the advantage of greater security and more reliability than Windows.

PS C:\Users\Homer\Documents> ls | findstr "STRI*[0-9]*"
-a---        23/05/1996     18:03   28377364 STRIFE1.WAD

This construct will not work on Powershell though. This will convert the content of a shell variable into uppercase.

john@adeptus-mechanicus ~/Documents $ echo -e ${LOGNAME^^}

There are some awesome tricks that you can use with the bash shell that do not work with Powershell. There are a few sample commands here: http://www.securitronlinux.com/bejiitaswrath/cispa-bill-still-a-threat-and-awesome-linux-shell-tricks/. The problem with the Powershell is that the commands are longer to type than the UNIX equivalents. They need to be simplified a bit, and add some more functionality like awk and gawk. Take the command below as a example of how easy it is to find and delete files on a Linux filesystem.

john@adeptus-mechanicus ~/Documents $ find /home/$LOGNAME/Documents  -name "*.o" -delete

In Powershell, you would have to type this, which is far more complex and confusing.

get-childitem c:\ -include *.TMN -recurse | foreach ($_) {remove-item $_.fullname}

So the bash shell still wins over the Powershell command line.

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *