Hello! I am fairly new to the Linux world, and I’ve been mainly using openSUSE since I started out. It’s what I’m most familiar and comfortable with.
I know that to set a static address without using the interactive yast, you need to edit (/etc/syconfig/network) ifcfg-eth0, routes and resolv.conf (+ /etc/hostname).
How would I go about to configure this via commands, rather than manually editing files?
Surely there’s also a way to “find and replace” via some above-my-knowledge text manipulation tools like awk, but I’m hoping for a simpler solution I can implement into a script I’m working on (also bash scripting newbie).
My goal is to set a static address on my system via a script I’m writing. Ergo I cannot manually edit files or use any interactive management tools like YaST.
Well, when we prefer to use Wicked, we use YaST. Just once at installation (probably by doing it through the installer), and that is it.
Maybe once in so many years you need to change your IP address, netmask, etc. and then we use YaST.
Many people that have openSUSE on “walk around” devices (lap-tops and the like), use Network Manager.
That is IMHO how it is “generally done on openSUSE” (not SUSE, or maybe it is also done on SUSE, but that is not subject op these forums).
Script is just a tool to achieve some goal. You do not explain, why you need to use this script. So far it sounds like school homework assignment.
Anyway - the tool to edit network configuration files is YaST. I am not aware of any other tool. It is trivial to write shell script to do it (it is less trivial to write good script with input check and error handling) but it hardly belongs to Network/Internet - ask in Programming section.