My first github script

zgb59

New Member
Joined
Feb 8, 2025
Messages
9
Reaction score
9
Credits
93
Hello everyone,

I’ve been studying Linux for a few months now, and I set myself the challenge of creating 12 scripts and uploading them to github before the end of the year — as a way to learn Bash scripting and Linux in general. I wanted to share the first script I uploaded to GitHub. I have more in progress, but I liked this one as the first. I’d love to hear your feedback and critiques on the script and on how I’m using GitHub generally, to see what I can improve. Im sure there is a lot of room for improvement.

About the script: it's fairly simple — it shows the IPv4, IPv6, and MAC addresses of the machine and gives you the option to copy each one individually to the clipboard. It requires xclip or xsel, depending on the distro. I’ve been testing on Ubuntu and an AlmaLinux VM — I still need to check on Arch.
Here is the repo
 


Good luck! Understanding Bash scripting can help, especially if you intend to work in the industry. It's one of the lower levels for automating things and quite versitile.
 
Good luck! Understanding Bash scripting can help, especially if you intend to work in the industry. It's one of the lower levels for automating things and quite versitile.
Thanks, now I'm working towards my first Linux certification and there is a lot of things that I like about Linux. The more I use it the more I like it. And bash scripting is awesome, it is so cool to make my own scripts and learn a lot in the process.
 
Not bad for a start, here is a hint if you want.
You're using if [ "$family" == "debian" ] || [ "$family" == "arch" ]; then on multiple lines.

This can be made more readable by making a new variable that says for instance
status=$([ "$family" == "debian" ] || [ "$family" == "arch" ])

Then you can just use the status variable instead of repeating the code.
 
Not bad for a start, here is a hint if you want.
You're using if [ "$family" == "debian" ] || [ "$family" == "arch" ]; then on multiple lines.

This can be made more readable by making a new variable that says for instance
status=$([ "$family" == "debian" ] || [ "$family" == "arch" ])

Then you can just use the status variable instead of repeating the code.
Hello CaffeineAddict,

That's awesome, thank you very much
I will try it that way

Greetings
 


Follow Linux.org

Members online


Top