Recently i wanted to get an IP of a domain from within linux command line,

the command is:
dig +short

but this command returned several IPs one per line. SO icwanted to have only one line in that command output. So i asked Google:

- linux command use only first line output
- how to use only n line out of command result

i found this:
dig +short | head -n 1
it will return just first line. If one wants to give this IP into variable, it can be done:
variablename=$(dig +short $domain | head -n 1)