0
grep ^IPADDR= /etc/sysconfig/network-scripts/ifcfg-$devicename

Can i just do $devicename without any brackets? Because I'm having using a head -1 to read off the first line of the file which will than be append to the $devicename. But when I run it, it says grep: enp0s3: No such file or directory or grep: lo: No such file or directory

2
  • possible duplicate of grep for expression containing variable Commented Jul 16, 2015 at 14:49
  • 2
    your variable $devicename probably has a space at the start. Commented Jul 16, 2015 at 14:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.