Hacker News new | ask | show | jobs
by SwellJoe 4116 days ago
Perl started with roughly the same goal. awk, sed, grep, etc. weren't quite powerful enough, C was too low-level, Perl mixed them all up with real programming language features, while still being very usable in one-liners.

I don't think this improves on Perl. Being compiled to Bash might be interesting, if your deployment systems don't have Perl. It used to be unthinkable that any UNIX/Linux system wouldn't have Perl...but, several distros no longer install Perl by default (which is annoying as hell, to me, as Python isn't at all an acceptable substitute for one-liners and shell+ tasks). But, in that case, it would need to compile down to POSIX shell, because Ubuntu doesn't install bash by default, it uses ash (a small POSIX shell). So, bash has the exact same flaw as Perl for that use case.

Anyway, I don't generally think this adds things that I wish for when working with shell scripting, and having to compile it (even a quick compilation like this is likely to be) takes away one of the biggest benefits of scripting languages.

2 comments

This reminds me of another Larry Wall quote about the bad (old?) days: "It's easier to port a shell than a shell script." I'm honestly surprised and a bit disappointed that Bash isn't universal these days.

This seems like a really bad idea, since it apparently throws out good things like pipes, input/output redirection, wildcard expansion, and interactivity, but doesn't offer anything over the standard scripting languages.

> because Ubuntu doesn't install bash by default, it uses ash (a small POSIX shell). So, bash has the exact same flaw as Perl for that use case.

Do you have a citation for this? I just checked my boxes and servers and they all have bash and are using it directly as the default shell. I never had to install bash myself on these machines.

Ubuntu uses dash as the system shell. The default login shell is still bash. While /bin/sh is symlinked to /bin/dash - you are probably using bash from your terminal, unless you changed it.

Actually I just checked by /bin/sh and it's pointed to /bin/bash on my laptop (14.10) but on my desktop it is /bin/dash (also 14.10). Now I have some investigating to do. I suspect I did something that changed that but I don't remember doing it.

Oops, you're right. dash and not ash. Definitely not bash, by default, however. I had to rewrite our install script to be POSIX friendly when the switch was made a few years ago. Not entirely awful, I guess, as the Ubuntu folks provided a really nice guide for converting.

https://wiki.ubuntu.com/DashAsBinSh

It's actually dash. Sorry. Misremembered.

https://wiki.ubuntu.com/DashAsBinSh