I am new to shell scripting and trying to create a shell script which will extract and print only ip address from ifconfig command and not all the information. I have two issues here -
1. To know active interface like eth0, wl0, etc.
- I guess `route` command will give me interface name in last column.
So I wrote below code -
route command gives output as -
Now I am not sure how to extract wlp3s0 from this output.
2. when I am able to get this wlp3s0 from above output, I will run - ifconfig wlp3s0
which will give me below output -
Again I would want to extract 192.168.0.9 from this output and print it.
Any help would be greatly appreciated.
Moderator's Comments:
Please use CODE - not QUOTE - tags as required by forum rules!
Last edited by RudiC; 03-15-2017 at 03:50 PM..
Reason: Changed QUOTE to CODE tags.
Unable to run the ifconfig in my home dir..
I did add adding /sbin and /usr/sbin in th PATH
But still unable to get that ..
Am using red hat linux
cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.3 (Tikanga) (3 Replies)
Hi All,
I need some info on ifconfig.
ifconfig is available in Linux and Solaris. However the options available in Solaris is not there in Linux.
1. ifconfig -a == output is different in both OS. I am somewhat able to compare the output. But one thing I am not getting is after the flags... (2 Replies)
I am running on AIX 5.3. I have a remote AIX server running on a generator. Many times the generator goes out and I only have a window of 15 mins with the network up and 30 mins the server is powered. I need help creating a script using ifconfig, where it goes out and checks the network every 5... (2 Replies)
I'm a newbie to linux, so pleases forgive me!
I would like to find a script that I could use to extract a dynamic ip from the ppp0 and set it as a variable to be used in IPTables
basically, if ppp0 ip address is 10.10.10.20, I would like a script that would set a var to 10.10.10.0. of... (9 Replies)
Hi all,,i have problem with my homework form my lecture..
He is give me a homework to create:
ifconfig eth0 0.255.255.255 1.1.168.192
my lecture says, i can making the shell scripting to finish my homework..
i have question, can setting ifconfig like in the upper? (1 Reply)
Hi All,
I logged into a sun microsystems server box, using both a vnc session and a ssh session. I am able to use "ifconfig -a" in a ssh session, but the same on a vnc session says that its a invalid command. how is this possible, when i am logging into the same box through two different... (4 Replies)
hey,
I know that ifconfig on linux systems is identical to win ipconfig.
I wanted to know if there is a linux distribution (new or old) that uses the ipconfig command.
thanks alot :) (2 Replies)
why the ifconfig command is not working in my machine?
it says "-bash: ifconfig: command not found"
why its says that?
actually i m looking for "how can I know the Network Interface Card physical address?"
Requesting u all for help.
thanks (3 Replies)
I am trying to change an IP address on a machine running HPUX10
After I change it I can ping it from the outside but it completely locks the console. After a reboot it returns back to its previous IP. Any ideas??
Thanks
Brian (7 Replies)