Bug 90001
| Summary: | inefficient use of awk/grep | ||
|---|---|---|---|
| Product: | [Retired] Red Hat Linux | Reporter: | Stephen Samuel <samuel> |
| Component: | initscripts | Assignee: | Bill Nottingham <notting> |
| Status: | CLOSED RAWHIDE | QA Contact: | Brock Organ <borgan> |
| Severity: | low | Docs Contact: | |
| Priority: | low | ||
| Version: | 9 | CC: | rvokal |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | 7.20-1 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2003-05-02 16:45:03 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
The grep needs to go, yes. We can't use wc, it's on /usr. Fixed in CVS, will be in 7.20-1. |
Description of problem: In /etc/sysconfig/network-scripts/ifup line 265: NUMDEFROUTES=`ip -o route | \ grep "^default" | \ awk '{ nlines++ } END { print nlines }'` This is an inneficient/ silly use of awk. far better to simply use `wc -c` (wc is 1/10th the size of awk) either that, or get rid of grep and change the third line to: awk '/^default/{ nlines++ } END { print nlines }'` Version-Release number of selected component (if applicable): initscripts-7.14-1 How reproducible: always Steps to Reproduce: 1.Read the Source, luke! (sorry!) Actual results: It works (a bit inefficient and kludgey, but it works) Expected results: elegance Additional info: