Shell programming style -- a plea for better shell scripts
stan at teltone.UUCP
stan at teltone.UUCP
Sun Feb 12 12:25:05 AEST 1984
> From: mce at teldata.UUCP (Brian McElhinney)
>
> *Sigh* I agree that sh is much more portable, but reading sh scripts
> is painful... "case" and "esac"??? UNIX supports C, a standard UNIX
> shell should at least resemble C. I never have understood why the Bourne
> shell looks like Algol. (Not that I think a change is possible, just that
> this is one more reason UNIX is not easily accepted)
Instead of case ... in ... esac you can do
case X
{
X)
.
.
}
You can also replace the for .. [ in ... ] do ... done
with for .. [ in ... ] { ... }.
This doesn't work for the while loop though (darn!).
This works on 4.1bsd and Venix Bourne shells, but I don't know how
portable it is to other versions.
More information about the Comp.unix
mailing list