I wanted to know whether scripts written for dash, ash, and sh are 100% compatible?
Are there any added features to dash or ash, or syntax change?
From what I heard, ash is a direct descendant of sh.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
The short answer is no, they're not 100% compatible.
But most of the shells are pretty close to the basic, so you would only rarely bump into inconsistencies. In fact, most shells differ not much by added syntax, but by some extra features like tab-completion and similar.
dash is sort of a descendant of
ash — or port from BSD to Linux, to be precise. And all of them should be descendants or different implementations of
sh. In fact,
sh is on most systems just a symlink to
dash or something else. What matters is POSIX compliance — and when you write scripts according to the standards, you won't run into problems.
The difference between those shells is in optimizations and performance. They're less feature-rich then
bash, but they are fully legitimate shells. Bash is feature-rich for interactive work, but uses more memory, for example.