How would I export information produced from script onto a text file [duplicate]












1















This question already has an answer here:




  • How do I save terminal output to a file?

    7 answers




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










share|improve this question













marked as duplicate by terdon bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 6 at 23:38


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.




















    1















    This question already has an answer here:




    • How do I save terminal output to a file?

      7 answers




    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










    share|improve this question













    marked as duplicate by terdon bash
    Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

    StackExchange.ready(function() {
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function() {
    $hover.showInfoMessage('', {
    messageElement: $msg.clone().show(),
    transient: false,
    position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
    dismissable: false,
    relativeToBody: true
    });
    },
    function() {
    StackExchange.helpers.removeMessages();
    }
    );
    });
    });
    Jan 6 at 23:38


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















      1












      1








      1








      This question already has an answer here:




      • How do I save terminal output to a file?

        7 answers




      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










      share|improve this question














      This question already has an answer here:




      • How do I save terminal output to a file?

        7 answers




      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





      This question already has an answer here:




      • How do I save terminal output to a file?

        7 answers








      bash scripts






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 6 at 23:17









      JymesJymes

      263




      263




      marked as duplicate by terdon bash
      Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Jan 6 at 23:38


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






      marked as duplicate by terdon bash
      Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Jan 6 at 23:38


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
























          1 Answer
          1






          active

          oldest

          votes


















          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.






          share|improve this answer























          • Thanks for the help
            – Jymes
            Jan 6 at 23:32










          • @Jymes , you're welcome
            – Bohdan Tkhir
            Jan 6 at 23:34


















          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          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.






          share|improve this answer























          • Thanks for the help
            – Jymes
            Jan 6 at 23:32










          • @Jymes , you're welcome
            – Bohdan Tkhir
            Jan 6 at 23:34
















          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.






          share|improve this answer























          • Thanks for the help
            – Jymes
            Jan 6 at 23:32










          • @Jymes , you're welcome
            – Bohdan Tkhir
            Jan 6 at 23:34














          0












          0








          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.






          share|improve this answer














          ./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.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 6 at 23:32

























          answered Jan 6 at 23:23









          Bohdan TkhirBohdan Tkhir

          11




          11












          • Thanks for the help
            – Jymes
            Jan 6 at 23:32










          • @Jymes , you're welcome
            – Bohdan Tkhir
            Jan 6 at 23:34


















          • Thanks for the help
            – Jymes
            Jan 6 at 23:32










          • @Jymes , you're welcome
            – Bohdan Tkhir
            Jan 6 at 23:34
















          Thanks for the help
          – Jymes
          Jan 6 at 23:32




          Thanks for the help
          – Jymes
          Jan 6 at 23:32












          @Jymes , you're welcome
          – Bohdan Tkhir
          Jan 6 at 23:34




          @Jymes , you're welcome
          – Bohdan Tkhir
          Jan 6 at 23:34



          Popular posts from this blog

          How to make a Squid Proxy server?

          第一次世界大戦

          Touch on Surface Book