Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[Q] Need help writing a simple interactive bash script

OP Flandro

3rd February 2014, 05:56 AM   |  #1  
OP Senior Member
Thanks Meter: 26
 
147 posts
Join Date:Joined: Oct 2009
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 192.168.1.5/24 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
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes