Avatar of PJ0302917

asked on 

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

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

LinuxShell Scripting

Avatar of undefined
Last Comment

8/22/2022 - Mon