1

Scripting novice here.

I have created a script which can show you the ip address of the website which has been entered.

My script:

#! /bin/bash

echo "Enter web address : "
read address 
echo "Entered web address : $address"
nslookup "$address"

Script in use:

Enter web address : google.com

Server:     127.0.1.1
Address:    127.0.1.1#53

Non-authoritative answer:
Name:   google.com
Address: 216.58.206.46

How would I then export that information into a text file?

Thanks

0

1 Answer 1

0
./someScript.sh > someFile.txt

Now enter address (e.g. google.com) and hit enter

Or more correct solution - edit script. For example:

#! /bin/bash

echo "Enter web address : "
read address 
echo "Entered web address : $address"
nslookup "$address" > someLogFile.txt

UPD fr you:

The '>' sign here means redirection to file , so if you will type echo 666 > file.txt there will be created file.txt with 666 text inside.

1
  • @Jymes , you're welcome Jan 6, 2019 at 23:34

Not the answer you're looking for? Browse other questions tagged .