puppylinux-woof-CE / Pkg

Pkg for woof-ce (theoretically). Upstream: https://gitlab.com/sc0ttj/Pkg
GNU General Public License v2.0
5 stars 4 forks source link

Use IFS to parse pipe delimited files #3

Open sc0ttj opened 5 years ago

sc0ttj commented 5 years ago

Rewrite Pkg, a function at a time, to use the much nicer IFS method of parsing repo files:

IFS="|"
while read Field1 Field2 ... FieldN; do
#stuff with fields - there should be no cuts, greps, seds etc...
done < pkgdbFile

This will make Pkg faster to run, and also easier to maintain.

EDIT: see fixed example below

01micko commented 5 years ago

If you do this change IFS as part of the loop conditions

while IFS='|' read F1 F2 ... FN; do
# do stuff
done  <  pkdb