[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cat.sh issue
From: |
Bob Proulx |
Subject: |
Re: cat.sh issue |
Date: |
Wed, 25 Mar 2009 17:53:27 -0600 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Matt@ice.filescope.com wrote:
> The question I have is why couldn't echo have a -- flag? Is it for
> POSIX or some other kind of compatibility reasons?
The reason echo doesn't have it is because it never had it before.
There are really (at least) two different types of echo commands. One
interprets escape sequences and the other does not, it needs -e to
tell it to do so. After 40 years of Unix history those two flavors
haven't been converged and so probably never will be converged. If
that hasn't happened then updating echo to support "--" doesn't have a
chance of getting in there.
Strangely, 'echo' is one of the most problematic to use portably.
> Is there any easier way to accomplish what I want other than printf
> %s\\n "$var"?
As Eric said, using printf is recommended for portability. It is a
new command and came on the scene with defined behavior. So you are
doing well to have used printf in your solution.
Bob