Results 1 to 3 of 3

Thread: Script to Create a Text File with My ifconfig Info

  1. #1
    Join Date
    Oct 2007
    Beans
    178

    Red face Script to Create a Text File with My ifconfig Info

    Hello Community,
    I'm trying to figure out how to create a script which will write a text file of my ifconfig info. So far I have this but I don't know what will save it into the *.txt file.

    Code:
    #!/bin/bash
    echo "My ifconfig info is:"
    ifconfig
    After I run the .sh file, I would create a ifconfig.txt file.

    Thanks for any help.
    CPU:AMD Turion(tm) 64 X2 Mobile Technology TL-52*slot: Socket S1,1600MHz*RAM: DIMM DDR2 667 MHz X 2 1GB*HDISK: Western Digital ATA Disk (320GB)*video: nVidia Geforce Go 6150 clock: 66MHz*wifi: Broadcom Corporation BCM4311
    eth0: nVidia MCP51

  2. #2
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,574
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Script to Create a Text File with My ifconfig Info

    Hi chiques.

    Just redirect the output from the standard (terminal) to a file. For instance:
    Code:
    #!/bin/bash
    echo "My ifconfig info is:" > interface.txt
    ifconfig >> interface.txt
    Alternatively, you could leave it like it is and redirect the output on the call itself:
    Code:
    ./yourscript.sh > interface.txt
    Hope it helps. Let us know how it goes.
    Regards.

  3. #3
    Join Date
    Oct 2007
    Beans
    178

    Re: Script to Create a Text File with My ifconfig Info

    Hi papibe,
    Yeah, that's pretty much what I ended up doing. I thought there was a way to do it all in one script but why make things more difficult that they have to be. Thanks!
    CPU:AMD Turion(tm) 64 X2 Mobile Technology TL-52*slot: Socket S1,1600MHz*RAM: DIMM DDR2 667 MHz X 2 1GB*HDISK: Western Digital ATA Disk (320GB)*video: nVidia Geforce Go 6150 clock: 66MHz*wifi: Broadcom Corporation BCM4311
    eth0: nVidia MCP51

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •