News for hackers. Stuff that matters.
Re:Hello Go by ktpsns on Monday April 30, 2018 @08:35AM (#16958027)
> Note: If you are on Microsoft Windows without a UNIX like environment you might want to re-evaluate your life choices at this moment.

Great sentence! However, Powershell got quite mature. `cat -n` is definetly something you will be able to do in Powershell with a similarly lengthy command.

Re:Hello Go by AskewEgret on Monday April 30, 2018 @09:44AM (#16958491)
Of course. Get-Content puts every line of text into the pipeline as a .Net String object with a few additional attributes added on, including ReadCount which is the line number. For example:

Get-Content -Path TEXT.TXT | %{"$($_.ReadCount) $($_.Length) $($_.ToUpper())" }

For each line of text, this will print the line number, the length of the string, and the string converted into upper case.

PowerShell is very wordy, but very powerful.

Re:Hello Go by Cthulhu_ on Monday April 30, 2018 @10:58AM (#16959064)
I'm neither a sh nor powershell guru, but, it kinda feels like that Powershell was intended more as a scripting language, less as a commandline language. sh / bash / etc commands are more terse, but harder to read if they're composed into a shell script.

I mean I still can't wrap my head around [ being a command / executable usable in conditions.

Re:Hello Go by brudgers on Monday April 30, 2018 @11:37AM (#16959497)
The terseness of Bash etc. is a tradeoff. "cat" is short for "concatenate." It's common use to list a single file is more the exploitation of an ambiguous API than a feature...concatenation of one file is like the sound of one hand clapping. I mean "to display the contents of a file use 'cat filename'" is an example of how *nix terseness makes understanding dependent on oral tradition rather than clear written communication. Even the man page doesn't describe using cat to display the contents of a single file [1]. It is only implied via the stdin example once a person understands the abstract relationship between the terminal and files.

[1]: https://linux.die.net/man/1/cat

Re:Hello Go by AnIdiotOnTheNet on Monday April 30, 2018 @11:56AM (#16959659)
Since shell languages invariably end up becoming scripting languages (see: Bourne shell and resulting nightmare), Powershell targets being a good tool for both purposes.

When scripting and writing documentation, full commandlet names are encouraged:

  Get-ChildItem | Where-Object { $_.Name.Contains("evidence") } | Remove-Item
When using the command line, there are built-in shortcuts (and users may define their own aliases):

  gci | ?{ $_.name.contains("evidence") } | ri
For the convenience of those hopelessly entrenched in Bourne shell, there are some default aliases:

  ls | ?{ $_.name.contains("evidence") } | rm
Re:Hello Go by stcredzero on Monday April 30, 2018 @12:51PM (#16960169)
Since shell languages invariably end up becoming scripting languages

We need to start paying attention to this phenomenon.

Re:Hello Go by wruza on Monday April 30, 2018 @01:24PM (#16960443)
It’s like | perl -pe ‘$_=join(“ “, $., length, uc)’, but with brand new syntax, so cool. PS also can help you build any non-mingw/make/sh based dependency, if you find one.
Re:Hello Go by pmarin on Monday April 30, 2018 @01:12PM (#16960361)
20 years using unix systems and never used cat with arguments.

nl(1)

Re:Hello Go by omaranto on Monday April 30, 2018 @01:33PM (#16960531)
I agree that nl is better for line numbering, but have you really never used cat with arguments? One of the most common use cases is for concatenating files:

    cat file1 file2 > combined-file
There file1 and file2 are arguments. What do you use cat for?
Re:Hello Go by pmarin on Monday April 30, 2018 @01:37PM (#16960565)
I mean flag arguments.

sed {} file1 file2 > combined-file

Re:Hello Go by pjmlp on Monday April 30, 2018 @03:49PM (#16961653)
Depends, some people do prefer environments that are more welcoming to the Xerox PARC ideas of how a development environment should look like.
Re:Hello Go by caspervonb on Monday April 30, 2018 @08:58AM (#16958176)
Haven't tried WSL yet but that's an option. Also most if not all of the GNU coreutils are available on Windows.
Re:Hello Go by colek42 on Monday April 30, 2018 @09:27AM (#16958381)
The file system performance was horrendous when I last used it for anything serious last fall.
Re:Hello Go by cube2222 on Monday April 30, 2018 @11:44AM (#16959556)
Which matters if you have 15k packages from npm to get (been there, done that) but doesn't matter at all when you're programming in Go.
Re:Hello Go by colek42 on Sunday May 13, 2018 @04:05PM (#17060750)
Dep/Glide can get pretty slow.
Re:Hello Go by panopticon on Monday April 30, 2018 @01:26PM (#16960472)
File system performance seems great for me, but I've only been seriously using WSL for the last 6 months or so.

That being said, there are some major performance issues with how certain programs map memory and, as a result, things like Haskell are an absolute pain to use.

Re:Hello Go by tome on Monday April 30, 2018 @01:28PM (#16960488)
I'm using Haskell right now. It's fine.