Hey everyone! I just wrote my first bash script and I'm looking for some constructive criticism. It's still a work in progress, and I'd like to improve it by incorporating a progress tracker for the MakeMKV section. Additionally, I'm considering extracting the movie name directly from the disc drive rather than manually typing it. I have over 1000 DVDs to process, so I'd also like to modify it to allow ripping from two different drives. I'm intentionally storing the MKV and MP4 files in separate locations and burning subtitles with the MP4s. If anyone has suggestions for these improvements or any other tips, they'd be greatly appreciated! I've included my script below for anyone interested in tweaking it for purposes with MakeMKV and HandBrakeCLI.
2 Answers
You might want to consider using command-line arguments (like $1) instead of using 'read' to gather input from users. This way, you can easily check how many arguments were passed with '$#'. It can make your script more flexible!
Since you’re focusing on bash scripting, adopting bash conventions is crucial. For instance, use [[ ... ]] instead of [ ... ] for your test expressions. And remember to send error messages to stderr, so try things like 'echo "Error occurred" >&2'. It's a more standard practice.

Also, consider double-checking if your script can handle missing or unexpected inputs gracefully. It can prevent crashes.