Find the answer to your Linux question:
Results 1 to 3 of 3
I have a file called eth1 that simply has its IP address as the content. I am looking for a way to snag the contenets of that file and set ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2005
    Posts
    5

    variables


    I have a file called eth1 that simply has its IP address as the content. I am looking for a way to snag the contenets of that file and set it as a variable within a shell script. Thoughts?

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Code:
    #!/bin/bash
    ip=`cat eth1`
    and make sure those are backticks not quotes.

  3. #3
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Or even quicker,

    Code:
    #!/bin/bash
    ip=$&#40;<eth1&#41;
    This is actually a Korn shell technique that bash has imported.

Posting Permissions

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