I'm a beginner looking to improve my coding skills and I've written a couple of scripts (around 50 lines each, not counting comments). While they work, I want to ensure I'm not making any major mistakes or writing inefficient code. Is there a community or platform where I can share my scripts for critiquing? Here are the links to the scripts: [Script 1](https://gitlab.com/rayken.wong/random_scripts/-/blob/main/QR-code-bookmarking/qrtobookmarks-pdftk?ref_type=heads) and [Script 2](https://gitlab.com/rayken.wong/random_scripts/-/blob/main/QR-code-bookmarking/qrtobookmarks(pdftk).ps1?ref_type=heads).
3 Answers
Hey! While I'm not a bash expert, I can provide some feedback on your scripts. Here are a few tips:
1. Use meaningful variable names instead of generic ones like var0 and folder1.
2. Consider reducing the number of comments – rely more on clean code.
3. Break your code into functions. It improves readability and reduces the need for excessive comments.
4. Use "#!/usr/bin/env bash" for better portability.
5. Rearranging your code to define variables before commands might be more logical.
6. Implement error handling to manage failures gracefully.
7. Avoid naming conflicts in nested scopes to prevent confusion.
8. Try to reduce nesting by using function calls.
Hope that helps!
Thanks for the insights! I’ll take a closer look at these suggestions!
If you post your scripts on GitHub, I'd be happy to take a look and provide feedback! Let me know when you do.
I've updated the links in my post! Thank you for your willingness to help!
Just a quick note: in Linux, you can use the 'file' command to identify file types accurately, which can help you out beyond just looking at extensions. Here's a quick guide on it: https://www.hostinger.com/tutorials/linux-file-command. Good luck!

Great advice! Splitting the code into functions is a game-changer for debugging. Future you will definitely appreciate clearer variable names!