Hacker News new | past | comments | ask | show | jobs | submit login

For scripting, I recommend the rc shell from plan9, which is the one I use for my shell scripts. It is only when I want to share a script with other people that I consider using /bin/sh, and even then more often than not I've gone for rc.

I invite you to read about it: http://doc.cat-v.org/plan_9/4th_edition/papers/rc.

I find the control structures simpler and more elegant, and overall its design feels more consistent. For example, consider an if statement in bash:

  if [ condition ]; then
    ...
  else
    ...
  fi
And now in rc:

  if (condition) {
    ...
  } else {
    ...
  }
Or a case statement in bash:

  case $1 in
    "bar")
      ... ;;
    "baz")
      ... ;;
  esac
And expressed in rc:

  switch ($1) {
    case "bar"
      ...
    case "baz"
      ...
  }
In the past, I've used it as my shell too, but now I use it only for scripting. I think you can install it in most platforms.



Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: