Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: A generic function/framework/mechanism for regular polling of data?



On Aug 11,  3:31pm, Richard Hartmann wrote:
}
} What, if any, is the canonical way to parse information from a file
} and putting that into variables.

The canonical way is for the file to be a simple series of assignment
statements, possibly with the occasional "typeset" command thrown in.

This is the reason that the shell uses an interpreted language.  If a
way to load variables is all you're looking for, I don't understand why
you're making this into a programming problem.

} PS: Mental note: Cleanly seperate what I know and what I want to
} know when asking questions. Do not ask about the whole concept,
} only ask about the missing pieces.

Well, no.  Context is often quite important.  Frequently the problem
with programming questions is that the questioner wants to fill in a
missing piece when really it's the entire concept that's wrong (or at
least sub-optimal).  At the very least lack of context makes it hard
to frame the right question.

Case in point:  My answer above doesn't seem to accomplish your first
goal, which (I thought) was how to describe to the shell a parser for
information in arbitrary formats from various sources about assorted
system state.  (The answer to which seems to be that no, zsh doesn't
have an internal equivalent of lex/yacc; the closest thing likely is
zregexparse, which is entirely undocumented except for the examples in
_regex_arguments in the completion system.)



Messages sorted by: Reverse Date, Date, Thread, Author