[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Structured (XML-like) input/output for shell apps?



On 6/13/05, GOMBAS Gabor <gombasg@sztaki.hu> wrote:
> > Are there already any plans to solve these issues?
> 
> Yes. The commands you mention were designed for _human_ consumption. Do
> not use them in scripts without good reasons. There are a lot of

The maintainer of netstat didn't want to change the layout (by
default) because scripts might get broken.
What's the solution here?

> commands to get well-formatted output without truncation. For example,
> ls has a "-n" option for exactly this reason; stat(1) can be used
> instead of "ls -l" to avoid clipping; ps has a _lot_ of formatting
> options itself and all the data can be found under /proc in an easily
> parseable format etc. You just have to select the right tool for the job
> (that also includes using more powerful scripting languages if the task
> is complicated).
 
> > I was thinking, using structured output (and maybe input) in an XML-like
> > way would solve these and allow neat post-processing.
> 
> XML is just _terrible_ for human input/output.

It's not meant for human IO, it's meant for IO to the next chain. The
final chain would then process it to normal text output.



Reply to: