Looking for Feedback on My Fedora Optimization Shell Script

    0
    6
    Asked By CuriousCat42 On

    Hey everyone! I've created a shell script aimed at optimizing Fedora right after a fresh install, and I'd love your feedback on it. Here's the link to the script: [crimsonhat.sh](https://github.com/somniasum/crimsonhat/blob/main/crimsonhat.sh). Any suggestions on improvements or best practices would be greatly appreciated! Thanks in advance!

    2 Answers

    Answered By CodeNinja201 On

    Another tip: avoid assuming terminal capabilities directly. Instead, use `tput` to fetch the necessary escape sequences, while also checking if the terminal supports them. For example, you can define colors like this: RED="$(tput setaf 1 || tput setf 4)". This way, if the terminal isn’t capable, your script won’t break.

    ScriptGenius -

    What do you suggest for better error handling? Any easy ways to implement it?

    Answered By TechWhiz99 On

    I noticed you’re using `set -euo pipefail` in your script. Just a heads up, only use this if you fully understand what each flag does. Most of the time, you can get away with just `set -u`. The `-e` flag can actually cause more issues than it solves, especially when you use `|| true` everywhere to bypass errors.

    HelpfulBunny -

    I agree, I'll make sure to simplify it to just 'set -u'!

    TechGuru88 -

    I use `pipefail` all the time, but be cautious with third-party tools like curl. Sometimes it’s better to manually check outputs instead of relying on `pipefail`. For most of my API calls, it does the job, but I understand your concerns.

    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.