Bash vs. Dash

Dash is a shell that has poor usability by modern standards when used as an interactive log-in shell, but is faster in executing POSIX-compliant scripts than Bash.Bash  has many more features and is especially preferable when used interactively (although it does contain more programming features too). Bash is typically provided as the default interactive shell, while Debian and Debian-derivatives like Ubuntu provide Dash as the /bin/sh implementation, thereby causing scripts with #!/bin/sh shebangs to be interpreted by Dash rather than Bash by default. For scripts that require Bash for execution, Bash will still be used as the interpreter if the shebang is #!/bin/bash. A large number of shell instances are started as part of the Ubuntu boot process. Rather than change each of them individually to run explicitly under /bin/dash, a change which would require significant ongoing maintenance and which would be liable to regress if not paid close attention, the Ubuntu core development team felt that it was best simply to change the default shell.

Advertisement - Continue Reading Below
Bash vs. Dash

Contents: Difference between Bash and Dash

What is Bash?

Bash is the Bourne-Again shell. Bash is an excellent full-featured shell appropriate for interactive use; indeed, it is still the default login shell. Bash is designed for human beings and provides a superset of POSIX functionality.

What is Dash?

Dash  is the  Debian  Almquist  Shell. Dash implements the Single Unix Spec, then it does not have to do more to meet that formal spec. Dash is for non-interactive script execution. Dash Only supports POSIX compliant features.

Key Differences between Bash and Dash

  1. Bash is an excellent full-featured shell appropriate for interactive use; indeed, it is still the default login shell. However, it is rather large and slow to start up and operate by comparison with dash.
  2. Dash implements the Single Unix Spec, then it does not have to do more to meet that formal spec. But some of the “bashisms” are convenient, would add little to the size of dash, and would make it far easier to use dash as an alternative.
  3. A lot of shell scripts which contain the command set –k are not supported by dash but supported by bash.
  4. Bash Supports the same scripting commands as Dash as well as its own additional commands, Dash Only supports POSIX compliant features.
  5. Bash is designed for human beings and provides a superset of POSIX functionality, Dash is for non-interactive script execution.
  6. Bash supports tab completion and Supports a command history.
  7. Dash is only 100K compared to Bash’s 900K.
  8. Dash is for Faster start-up and script execution as compared to Bash.
Advertisement - Continue Reading Below

Video Explanation

Advertisement - Continue Reading Below

Leave a Comment