How Can I Improve My First Bash Project?

0
6
Asked By QuietMaple42 On

I started using Linux about two years ago, but only began seriously learning Bash recently. After practicing basic conditionals, I built my first larger script, a project called MemiBank. The transfer functionality is nearly finished, and I'd appreciate constructive feedback on the script's structure, maintainability, and overall Bash practices. What would you improve or approach differently?

4 Answers

Answered By CaseGarden88 On

For a simple interactive menu, Bash already provides the built-in select construct. It can handle numbered choices and reduce the amount of custom menu code you need to maintain. Just make sure invalid input is handled clearly and avoid printing messages that could encourage unsafe password habits.

Answered By ConfigCloud19 On

Consider adding a configuration file with sensible defaults. You could also let users provide a custom config path as a command-line argument instead of hard-coding paths directly into the script.

Answered By ShellHarbor5 On

This is a solid start for a first project. You may also want to use a dispatch-style structure, where each command or menu action calls its own function or script. Keeping the components small will make future development and maintenance much easier.

Answered By ModularFox7 On

A good next step would be breaking the script into functions and separating larger pieces of logic into smaller modules or files. That will make the project easier to read, debug, test, and extend as it grows.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.