What are the significant differences between different shells?

12,531

Solution 1

Depends on which specific commands/features you are using but generally no.

See http://en.wikipedia.org/wiki/Comparison_of_command_shells for a summary of differences between shells.

Solution 2

No. Both bash and ksh have custom specific extensions and behavior. If you want to write portable scripts, stick to POSIX syntax:

http://pubs.opengroup.org/onlinepubs/009695399/utilities/sh.html

http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html

Solution 3

It's best to treat each separate shell as a separate programming language. Don't try to write polyglot shell scripts, it makes them unreadable and clunky. Instead, learn how to program in one shell and then be careful with always specify that shell as the script's interpreter in the hashbang on the first line.

Remember that the shell that your script is running in has nothing to do with the shell you're executing it from. Hence, you might be interacting with your UNIX system through csh while at the same time be writing all your shell scripts for ksh.

Share:
12,531

Related videos on Youtube

Community
Author by

Community

Updated on September 18, 2022

Comments