News for hackers. Stuff that matters.
Re:Something about functions in Bash (2017) by 3rdAccount on Thursday July 05, 2018 @11:02PM (#17468556)
We have a little hubris too. I spent years talking about how dumb Perl was. Then I learned Awk, Bash, and Unix and saw that Perl was a natural and evolutionary powerup with a massive script archive. Perl wasn't dumb, I just didn't understand the design decisions. Bash and many dynamic languages are similar. On another note, when I use Java/C# (languages I have little experience in), I always can't help but notice the lack of expressivity. I mean it takes 1/2 page of code to read a text file and print all lines that say "hello". In the Linux shell this could be:

cat filename | grep -i "hello"

Someone else will probably point out a better way. It is also only a couple of lines of Python.

Re:Something about functions in Bash (2017) by flukus on Thursday July 05, 2018 @11:12PM (#17468589)
> Someone else will probably point out a better way. It is also only a couple of lines of Python.

grep -i "hello" filename # ;)

> I always can't help but notice the lack of expressivity. I mean it takes 1/2 page of code to read a text file and print all lines that say "hello"

I think you hit the nail on the head there. I've used just about every build system known to man and we're currently using cake at work, which is uses c# as a scripting language. Everything is 10 times more verbose than the equivalent shell/makefile would be. Things like concatenating sql files are 30 lines instead of code instead of one liners.

Re:Something about functions in Bash (2017) by kccqzy on Thursday July 05, 2018 @11:28PM (#17468645)
It's just

    grep -i hello filename
Re:Something about functions in Bash (2017) by 3rdAccount on Friday July 06, 2018 @11:22AM (#17472146)
Haha, thanks! I always forget :)
Re:Something about functions in Bash (2017) by adrianN on Friday July 06, 2018 @04:44AM (#17469904)
It takes half a page because you get to choose things like buffering. Error handling is also much nicer.