Hacker News new | ask | show | jobs
by spelufo 3628 days ago
I used a port of the rc shell for linux as my login shell for a couple of months. I switched back to zsh eventually because rc doesn't have job control and autocompletion. The autocompletion wasn't that big an issue because it can use readline for history completion, and it can be configured so that when you type the start of a command and hit up arrow it will find the last command that started with what you typed. This can be replicated for zsh and bash, and it's arguably as good as autocompletion. I found no convinient work-around for the lack of job control, other than starting a new terminal.

How is rc better than bash or zsh? I've read the bash man pages and I couldn't figure out exactly how bash expands commands before executing them. Every time the shell see's an unquoted variable name (e.g. $foo) it will do word splitting, which is why you have to write "$foo" instead, or "${foo}bar" to distinguish "$foo" from "$foobar", etc. Add history and filename expansion and command substitution, weird syntax for control statements...

The best feature of rc is that word splitting and globbing happens once, and it results in a list of strings. There is no longer a need to quote variables all the time. No need to use filenames without spaces.

Here's what bash does:

    $ files=*; echo "$files"; echo $files
    *
    file1.txt file2.txt file3.txt
    $ # echo $files -> echo * -> file1.txt file2.txt file3.txt
Here's what rc does:

    $ files=*; echo $files
    file1.txt file2.txt file3.txt
    $ # files=(file1.txt file2.txt file3.txt)
    $ # echo $files -> echo file1.txt file2.txt file3.txt
It's similar to the situation for dynamic vs lexical scope.

http://plan9.bell-labs.com/sys/doc/rc.html

https://github.com/rakitzis/rc