[Q] Need help writing a simple interactive bash script

191 posts
Thanks Meter: 29
By Flandro, Senior Member on 3rd February 2014, 05:56 AM
Post Reply Subscribe to Thread Email Thread
Long story short, I have some Nexus 7s and ethernet adapters to go with them and need to configure eth0 with a static IP. I have already written scripts that run and configure eth0 with what we need at the moment. The script basically consists of one line that says "ip addr add dev eth0". It works great for what we need.

Every once in awhile we need our team to configure custom IPs on eth0 but these guys are even more noob than me, I've just been opening up Terminal and doing the same command from above but with different IP info by hand.

So my question, Could someone with some bash scripting knowledge give me a tip on how to write an interactive script that asks what IP, Netmask, Gateway then runs it with that IP info? It will probably involve echo commands, but again, I'm a noob and was hoping someone here would be able to help. Just a super simple interaction. Nothing too complex. Thanks in advance, also, if I'm posting this in the wrong forum, let me know. Thanks again.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes