how to get only ip address of host
hi,
my problem is when iam typing a=host test.com echo $a output test.com has address 17.108.43.86 now i want to print only address (17.108.43.86) and don't want to print this line [test.com has address] how to do this |
Hi,
Sure looks like 'homework' to me. Maybe you should review the LQ Rules; Quote:
Just a few links to aid you to gaining some understanding; 1. Linux Documentation Project 2. Rute Tutorial & Exposition 3. Linux Command Guide 4. Bash Beginners Guide 5. Bash Reference Manual 6. Advanced Bash-Scripting Guide 7. Linux Newbie Admin Guide 8. LinuxSelfHelp 9. Getting Started with Linux :hattip: The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links! |
I won't give the full solution (because it does look like homework), but try the "read" command on the output from "host" in a script.
|
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
|
All times are GMT -5. The time now is 08:40 AM. |