On Wed, Feb 11, 2004 at 11:48:09AM +0100, Jim Meyering wrote: > $ echo / // /// //// .// //. > $ echo abc| tr -t ab // Here's a trivial little debugging aid I can't live without, for testing and isolating just such things without driving oneself crazy, or resorting to painful contortions like that "tr" pipeline. Unlike echo: - because it's not a shell builtin, you can be sure that whatever effects you see are caused by the shell's generic command-line parsing, rather than by any special-case code for the particular command itself (well, you could get that by saying "/bin/echo", but see below) - it does *no* parsing or interpretation of the command-line arguments; it just spits out what it sees -- benefit as above - (irrelevent to your current problem) it shows you the argument boundaries, so you can quickly see whether your evals and variable substitutions expanded to: prargs a b c or: prargs "a b c" or: prargs a "b " c The blurb's twice the size of the program itself :-/ -- | | /\ |-_|/ > Eric Siegerman, Toronto, Ont. erics@xxxxxxxxxxxx | | / It must be said that they would have sounded better if the singer wouldn't throw his fellow band members to the ground and toss the drum kit around during songs. - Patrick Lenneau
/* * Copyright (C) 1998, by Eric Siegerman * You can do whatever you want with this thing -- commercial or otherwise. * No restrictions. */ #include <stdio.h> main(int argc, char *argv[]) { int i; for (i=0; i<argc; ++i) printf("%d: <%s>\n", i, argv[i]); }