Live data from Hacker News

Plan9 has been forked: 9front

ninetimes.cat-v.org

31–38 of 38 posts

Re: Plan9 has been forked: 9front

#31
post #28

After having some experience trying to write portable Bourne Shell scripts, I recently came across Tom Duff's paper[1] describing the "rc" shell used by Plan 9. I was quite blown away by the number of common shell-scripting problems it solves, and the elegance of the resulting language. There's no chance of it replacing, say, Python, but I'm sorely tempted to install Plan 9 From User Space and try out rc the next tim…

I was intrigued by your comment and took a look at the rc feature list, but I couldn't see any features that aren't available in bash 3.1 and above. This takes nothing away from rc of course, which was around when bash was a simple re-implementation of sh, and may very well have been the inspiration for some of bash's modern features. [1] With regards to scripting, since perl/python/ruby has supplanted shell for mode…

The main feature that Rc has which Bash lacks is simplicity. Bash's man page is twice the size of Rc's entire source code.

Re: Plan9 has been forked: 9front

#32
post #28

After having some experience trying to write portable Bourne Shell scripts, I recently came across Tom Duff's paper[1] describing the "rc" shell used by Plan 9. I was quite blown away by the number of common shell-scripting problems it solves, and the elegance of the resulting language. There's no chance of it replacing, say, Python, but I'm sorely tempted to install Plan 9 From User Space and try out rc the next tim…

I was intrigued by your comment and took a look at the rc feature list, but I couldn't see any features that aren't available in bash 3.1 and above. This takes nothing away from rc of course, which was around when bash was a simple re-implementation of sh, and may very well have been the inspiration for some of bash's modern features. [1] With regards to scripting, since perl/python/ruby has supplanted shell for mode…

rc solves problems with sh by replacing annoying/problematic features. bash adds the same features, but keeps all the problems with sh. Read the "Design Principles" section for specific examples.

Re: Plan9 has been forked: 9front

#35

What is the significance of the name "9front"?

The linked web-page spells out the full name as "Plan 9 from the People's Front of cat-v.org" - perhaps a reference to the "Judean People's Front/People's Front of Judea" split described in Monty Python's Life of Brian.

Re: Plan9 has been forked: 9front

#36
post #28

After having some experience trying to write portable Bourne Shell scripts, I recently came across Tom Duff's paper[1] describing the "rc" shell used by Plan 9. I was quite blown away by the number of common shell-scripting problems it solves, and the elegance of the resulting language. There's no chance of it replacing, say, Python, but I'm sorely tempted to install Plan 9 From User Space and try out rc the next tim…

I was intrigued by your comment and took a look at the rc feature list, but I couldn't see any features that aren't available in bash 3.1 and above. This takes nothing away from rc of course, which was around when bash was a simple re-implementation of sh, and may very well have been the inspiration for some of bash's modern features. [1] With regards to scripting, since perl/python/ruby has supplanted shell for mode…

I'm not an rc expert, merely a disgruntled POSIX shell scripter, so here are some attractive rc features [1] missing from sh and bash:

> Rc captures command exit status in the variable $status. For a simple command the value of $status is just as described above. For a pipeline $status is set to the concatenation of the statuses of the pipeline components with | characters for separators.

Both bash and ksh have the pipefail option, which at least makes the pipeline fail if any component fails. (Horrifyingly, POSIX sh lacks even this.) Actually seeing which component failed can be really handy. In other shells, you only get $?.

> Arbitrary file descriptors may be sent through a pipe by typing, for example, "vc junk.c |[2] grep -v ’^$’" This deletes blank lines from the C compiler’s error output.

POSIX sh, bash, and ksh can only connect stdout to stdin across a pipe. Connecting arbitrary descriptors is nice, particularly in logging applications.

> There is no need for the distinction between $* and $@. There is no need for four types of quotation, nor the extremely complicated rules that govern them.

How many people understand the difference between $* and $@ in POSIX sh or bash, or for instance the difference between "$@" and $@? These are critical things any POSIX shell scripter should know, yet I've met very few that actually do. One approach is to educate people about these things. Another is to avoid the need to educate them in the first place.

I like that rc cleans up quoting, which I've seen single-handedly scare developers off of shell scripting.

[1] http://doc.cat-v.org/plan_9/4th_edition/papers/rc

Re: Plan9 has been forked: 9front

#37
post #36
post #28

Earlier quoted context omitted.

I was intrigued by your comment and took a look at the rc feature list, but I couldn't see any features that aren't available in bash 3.1 and above. This takes nothing away from rc of course, which was around when bash was a simple re-implementation of sh, and may very well have been the inspiration for some of bash's modern features. [1] With regards to scripting, since perl/python/ruby has supplanted shell for mode…

I'm not an rc expert, merely a disgruntled POSIX shell scripter, so here are some attractive rc features [1] missing from sh and bash: > Rc captures command exit status in the variable $status. For a simple command the value of $status is just as described above. For a pipeline $status is set to the concatenation of the statuses of the pipeline components with | characters for separators. Both bash and ksh have the p…

so you call one command and want just to know if it failed... but that command triggered a series of pipes internally, now you have to trim the status mess?

thankfully truly posix stuff doesn't have it

Re: Plan9 has been forked: 9front

#38
post #37
post #36

Earlier quoted context omitted.

I'm not an rc expert, merely a disgruntled POSIX shell scripter, so here are some attractive rc features [1] missing from sh and bash: > Rc captures command exit status in the variable $status. For a simple command the value of $status is just as described above. For a pipeline $status is set to the concatenation of the statuses of the pipeline components with | characters for separators. Both bash and ksh have the p…

so you call one command and want just to know if it failed... but that command triggered a series of pipes internally, now you have to trim the status mess? thankfully truly posix stuff doesn't have it

but that command triggered a series of pipes internally, now you have to trim the status mess?

No. If you run an external command from an rc script, ie the shell is doing the fork and exec for you, then $status will have a single number just like $?.

It doesn't matter if the external command is an rc script that, internally, runs a pipeline at the end. You will only get a multi-status if the previous statement within the current rc script was a pipeline. Under sh, bash, or ksh, people rarely bother to look at $? in this situation, since it's either potentially irrelevant (without -o pipefail), or you don't know which program it's from (with -o pipefail).

so you call one command and want just to know if it failed

This works perfectly fine in rc:

   find . | grep '[0-9]' | wc || echo >[1=2] "number files not found"
From the rc docs:

> Any $status containing only 0’s and |’s has boolean value true. Any other status is false.

Post reply on HN