David A. Wheeler
2014-12-31 17:19:37 UTC
The POSIX-style shell tosses the double quotes at first point of use.
When a variable reference is itself "..." quoted, like "$variable",a POSIX shell does NOT toss the double-quotes.
When it's unquoted, a POSIX shell *does* toss the double-quotes.
I am *counting* on that behavior to make this scheme work.
This works out in makefiles at least.
Going back to my examples in a makefile:
SBCL =/cygdrive/c/"Program Files/Steel Bank Common Lisp/1.2.6/sbcl"
EGREP = /usr/bin/grep -E
Typically programs are invoked in a makefile as $(NAME),
and this 'just works' in the proposed convention:
dostuff:
$(SBCL) < x.src > x.dest
$(EGREP) pattern y.src >> x.dest
Arguments must be escaped varying amounts of times to survive a given
data path, and the data path may not be a fixed one.
Many shell programmers, out of habit,data path, and the data path may not be a fixed one.
always reference shell variables as "$variable_name" instead of $variable_name,
and then quoting survives just fine. It might not be hard to fix up the
remaining ones (it is a good habit anyway).
There might need to be a way to vary how replacements are done
(e.g., a Makefile would have the quoting scheme, while a #include file would not).
But the fundamental problem is that there's no way to distinguish the
different uses of spaces; once there's an input and storage convention,
you can then decide how to best output them.
--- David A. Wheeler