-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathifether
More file actions
43 lines (38 loc) · 843 Bytes
/
ifether
File metadata and controls
43 lines (38 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
## COD v.01
#if ( ifconfig | grep Link ) >> /dev/null
# then
# ifconfig | cut -d " " -f "1" | head -1
# else
# ifconfig | cut -d ":" -f "1" | head -1
#fi
## COD V.02
#ifconfig | head -1 | awk '{print $1}' | cut -d ":" -f "1" | head -1
## COD V.03
#ifconfig | head -1 | awk '{print $1}'
## COD v.04
#if ( ifconfig | grep Link ) >> /dev/null
# then
# ifconfig | head -1 | awk '{print $1}'
# else
# ifconfig | head -1 | awk '{print $1}' | cut -d ":" -f "1"
#fi
## COD v.05
case "$1" in
-a)
if ( ifconfig | grep Link ) >> /dev/null
then
ifconfig -a | head -1 | awk '{print $1}'
else
ifconfig -a | head -1 | awk '{print $1}' | cut -d ":" -f "1"
fi
;;
*)
if ( ifconfig | grep Link ) >> /dev/null
then
ifconfig | head -1 | awk '{print $1}'
else
ifconfig | head -1 | awk '{print $1}' | cut -d ":" -f "1"
fi
;;
esac