History

ver_linux: quota-tools, look for numerical input, not field number

Rely on regex to find the version number, rather than rely on numerical input to be found in a particular input field. Proposed implementation also eliminates the necessity to invoke 'grep' + 'awk'.

Alexander Kapshuk committed 11 years ago

Commit 8fb09591 parent f437d1e1 file · +6 −2Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/ver_linux+6−2
@@ -87,8 +87,12 @@ awk '/pcmciautils/{ · 86 unmodified lines
8787 cardmgr -V 2>&1| grep version | awk \
8888 'NR==1{print "pcmcia-cs ", $3}'
8989
90−quota -V 2>&1 | grep version | awk \
91−'NR==1{print "quota-tools ", $NF}'
90+quota -V 2>&1 |
91+awk '/version/{
92+ match($0, /[0-9]+([.]?[0-9]+)+/)
93+ printf("Quota-tools\t\t%s\n",
94+ substr($0,RSTART,RLENGTH))
95+}'
9296
9397 pppd --version 2>&1| grep version | awk \
9498 'NR==1{print "PPP ", $3}'

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t