# FreeBSD sh on Linux?



## sgeos (Mar 9, 2016)

Mildly curious, is there an easy way to use the FreeBSD sh on Linux?


----------



## SirDice (Mar 9, 2016)

On Debian/Ubuntu dash is probably the closest thing. Other distributions may also have ash.

https://en.wikipedia.org/wiki/Almquist_shell


----------



## Cthulhux (Mar 9, 2016)

The binary `sh` or the application that comes up when you type `sh` (i.e. `tcsh`, also available on Linux)?


----------



## SirDice (Mar 9, 2016)

Yes, tcsh(1) is also available on most distributions. Although the versions might differ a little.


----------



## Carpetsmoker (Mar 11, 2016)

SirDice said:


> On Debian/Ubuntu dash is probably the closest thing. Other distributions may also have ash.
> 
> https://en.wikipedia.org/wiki/Almquist_shell



Isn't that basically the same as the FreeBSD shell?

The manpages are very similar, anyway (and a hell of a lot more readable than bash's, which is an abomination of a manpage)



SirDice said:


> Yes, tcsh(1) is also available on most distributions. Although the versions might differ a little.



You almost make it sound like it undergoes a lot of changes ;-)


----------



## SirDice (Mar 11, 2016)

Carpetsmoker said:


> Isn't that basically the same as the FreeBSD shell?


It is. As far as I know 'our' /bin/sh is also based on the original Almquist Shell. There may be some small implementation differences but they should all be compatible with each other. The differences certainly aren't as big as the differences with bash for example. 



> You almost make it sound like it undergoes a lot of changes ;-)


Not much indeed. But I have noticed some slight differences on various different Linux distributions compared to FreeBSD's tcsh(1). It's good to be aware of it


----------



## kpa (Mar 11, 2016)

I don't see why you would need to install a shell on Linux for "FreeBSD compatibility". The bourne shells are very closely related and if you stick to the lowest common denominators when writing your scripts your scripts will work correctly on wide variety of platforms without any changes.


----------

