troubleshooting Question

Is it possible to read a variable from a file and use in a Sh script

Avatar of PJ0302917
PJ0302917 asked on
LinuxShell Scripting
9 Comments2 Solutions160 ViewsLast Modified:
In a file called ifcfg-eth0 there is a line which states HWADDR=XX:XX:XX:XX:XX

I have a script called "gatherdata" and have set a variable called "HWADDR" and I want the variable to be set to XX:XX:XX:XX:XX

Is there an easy way of doing this? ive had a look on google and have seen the source command but couldn't find a good example to fit my scenario.

Im on CentOS 6.8

Thanks
ASKER CERTIFIED SOLUTION
nociSoftware Engineer
Join our community to see this answer!
Unlock 2 Answers and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros