FreeBSD vs other *nixes

It’s been a small wonder to me since I used multiple *nixes: the user management tool in FreeBSD is syntactically different compared to other *nix.

Take for example adding user in non-interactive mode. In OpenBSD, Linux and Solaris the syntax is:

useradd -m -s /bin/tcsh -g staff edogawa

While in FreeBSD, for exact same thing, it is:

pw useradd edogawa -m -s /bin/tcsh -g staff

Yes, it’s a rather minor difference:

  • tool name is pw useradd instead of useradd
  • username is specified in the beginning instead of last

But I keep using the common syntax even when using FreeBSD which resulted in hilarious mistakes. It usually goes like this:

licia# useradd -m -s /bin/tcsh edogawa
useradd: Command not found.

Ah, it’s FreeBSD. *presses up, ctrl-a, pw, space, enter*

licia# pw useradd -m -s /bin/tcsh edogawa
pw: user name or id required

Ah, it’s friggin FreeBSD. *fixes command in full while grumbling*

licia# pw useradd edogawa -m -s /bin/tcsh

Finally! God, why FreeBSD do this.

I guess I should create wrapper function for things like this. It would go like this:

useradd() {
  username=...some_shift_magic...
  set ...some_more_shift_magic...
  pw useradd "$username" "$@"
}

Etc.

Yes, I’m still bored.

Leave a Reply

Your email address will not be published. Required fields are marked *