Which of the following commands should be used in a bash script that needs a variable containing the IP address of the eth0 interface?

Which of the following commands should be used in a bash script that needs a variable containing the IP address of the eth0 interface? The output from the command ifconfig eth0 is shown below:


A. IP=LANG= ifconfig eth0 | awk “{print $2}” | cut -f2
B. IP=$(LANG= ifconfig eth0 | grep inet | cut -d: -f2)
C. IP=’LANG= ifconfig eth0 | awk “{print $3}”‘
D. IP=’LANG= ifconfig eth0 | grep inet | cut -d: -f2 | awk {print $1}’
E. IP=$ (LANG= ifconfig eth0 | grep inet | awk “{print $2}” | cut -d: -f2)

Download Printable PDF. VALID exam to help you PASS.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.