news.volyx.in

Techniques I use to create a great user experience for shell scripts (nochlin.com)

412 points by hundredwatt · 696 days ago · 275 comments on HN

Article summary

The article discusses techniques used to create a great user experience for shell scripts, including comprehensive error handling, clear and colorful output, detailed progress reporting, and platform-specific adaptations. The author shares their experience with a shell script they wrote to automate evaluation steps for a challenge and highlights six techniques they used to make the script robust and user-friendly. The script's features include input validation, error handling, and timestamped file outputs. The author aims to inspire others to enhance the user experience in their own shell scripts.

Main themes

  • Shell Scripting
  • User Experience
  • Error Handling
  • Platform Adaptation
  • PowerShell vs Bash

What commenters say

  • The use of color and progress indicators in shell scripts can greatly improve the user experience, but may require additional checks for compatibility.
  • Some argue that PowerShell is more powerful and flexible than Bash due to its ability to handle objects and declare prerequisites, while others prefer Bash for its simplicity and Unix-like approach.
  • The lack of standardization in Linux tools and outputs can make it difficult to write robust and portable shell scripts, leading some to advocate for a more structured approach like PowerShell.
  • Others argue that the Unix philosophy of using simple, specialized tools that can be composed together is still a viable and effective approach, and that adding more complexity to the shell is not necessary.
  • There is a trade-off between the flexibility and customizability of Bash and the more structured and object-oriented approach of PowerShell, with different use cases and preferences leading to different choices.
  • Some developers are exploring alternative shells, such as NuShell, that aim to combine the best features of Bash and PowerShell.