Get the ip address in a shell script
# set the language to English, to avoid translation problems with ifconfig
export LANG=C
# get IP address of eth0 network interface
ifconfig eth0 | awk '/inet addr/ {split ($2,A,":"); print A[2]}'
# set the language to English, to avoid translation problems with ifconfig
export LANG=C
# get IP address of eth0 network interface
ifconfig eth0 | awk '/inet addr/ {split ($2,A,":"); print A[2]}'
Doesn’t work with french distributions.
Correction : ifconfig eth0 | awk ‘/inet adr/ {split ($2,A,”:”); print A[2]}’
‘addr’ => ‘adr’
Ok, but who on earth uses french locales?
Et bien moi
of course ^^