Read output of mii-tool


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Read output of mii-tool
# 1  
Old 02-14-2008
Read output of mii-tool

I am trying to create a small install script for gentoo. I am trying to research how to pass on information from a command i.e. mii-tool to autodiscover my network settings.

for instance

~ # mii-tool
eth0: no autonegotiation, 100baseTx-HD, link ok
eth1: 10 Mbit, half duplex, no link

shows me that eth0 is up the script then would then execute

net-setup eth0
# 2  
Old 02-17-2008
Seems pretty straightforward...
Code:
net-setup `mii-too | grep 'link ok' | cut -d ':' -f 1 | head -1`

(bourne compatible shell)

Untested

edit: If you want to do something more complex with the output, you can capture it in a variable first:
Code:
myeth=`mii-too | grep 'link ok' | cut -d ':' -f 1 | head -1`


Last edited by Smiling Dragon; 02-17-2008 at 07:29 PM.. Reason: Added 2nd example
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Output read variable

Hi all, how read varaible and ouput in colum, e.g. $ echo $VAR1 opc op odi games gopher vcsa abrt I like $ echo $VAR1 opc op odi games gopher vcsa abrt (3 Replies)
Discussion started by: aav1307
3 Replies

2. Solaris

How to read the output of snoop command?

Hi! I have run the following command: snoop -q -d e1000g0 -o /var/tmp/optima0.txt & them I am trying to read the output of it with snoop -i /var/tmp/optima0.txt, which is giving me this: # snoop -i /var/tmp/optima0.txt | more 1 0.00000 AIOPTSVR -> 10.100.4.72 TCP D=1393 S=22 Push... (8 Replies)
Discussion started by: fretagi
8 Replies

3. UNIX for Dummies Questions & Answers

pine email tool suppress prompt to save read messages

Could somebody please advise about how to configure pine/alpine so that on exit it doesn't prompt me to save read messages? Thanks (3 Replies)
Discussion started by: LeoKSimon
3 Replies

4. Programming

Tool to simulate non-sequential disk I/O (simulate db file sequential read) in C POSIX

Writing a Tool to simulate non-sequential disk I/O (simulate db file sequential read) in C POSIX I have over the years come across the same issue a couple of times, and it normally is that the read speed on SAN is absolutely atrocious when doing non-sequential I/O to the disks. Problem being of... (7 Replies)
Discussion started by: vrghost
7 Replies

5. Shell Programming and Scripting

How to read file and only output certain content

Hi - I have a file containing data like :- cn=tommy,cn=users,c=uk passwordexpirydate=20100530130623z cn=jane,cn=users,c=uk passwordexpirydate=20100423140734z cn=michael,cn=users,c=uk passwordexpirydate=20100331020044z I want to end up with a file that looks like:-... (6 Replies)
Discussion started by: sniper57
6 Replies

6. Programming

How to read output of a shell command

Hello All, I have a an application written in C and runing on Red Hat Linux. In my code I have written a command that is fired on the linux shell by using system() function call. Now I need to read the output of this command in my c program and assign it to a variable. Can anyone... (1 Reply)
Discussion started by: shamik
1 Replies

7. Shell Programming and Scripting

read output in ?

hi all! im making a program to update a file on a usb device. but the mount point is different from computer to computer depending on drives, now im updating the changes.lzm on a usb system based on slax. called backtrack, so thers a folder on the root of the memory stick called BT3. and i know... (3 Replies)
Discussion started by: pcstalljr
3 Replies

8. Shell Programming and Scripting

how do I say "if myvar = doe or ray or mii"

Ok, I have what I think is a relatively simple question, but being me I'll give the full background. In writing a new CheckSystem for one of my servers at work I want to check for core dumps. I was originally doing this like so: dumps=`ls -ltr /dvs/dncs/tmp/corefiles/|awk '{print $9}'|egrep... (5 Replies)
Discussion started by: DeCoTwc
5 Replies

9. Shell Programming and Scripting

How to read those files and output to base?

Hi, -rwxr-xr-x 1 abc mkpasswd 2483 Oct 20 15:42 0132200710-ps5_cdrm.unl -rwxr-xr-x 1 abc mkpasswd 1826 Oct 20 15:43 0132200710-ps5_cdrn.unl -rwxr-xr-x 1 abc mkpasswd 1788 Oct 20 15:44 0132200710-ps5_cdro.unl -rwxr-xr-x 1 abc mkpasswd 1681 Oct 20 15:44 0132200710-ps5_cdrp.unl -rwxr-xr-x... (4 Replies)
Discussion started by: rauphelhunter
4 Replies

10. Shell Programming and Scripting

Piping output to while read

Hi. Im using cat to output the contents of a file, then piping it to my while read loop.In this loop variables get assigned values. However when i try to use the variables outside the loop their values has been reset.I understand about subshells etc. but I have no idea how to "preserve" the... (3 Replies)
Discussion started by: Ultimodiablo
3 Replies
Login or Register to Ask a Question