[ksh93-integration-discuss] printf syntax and /sbin/sh compatibility
Shawn Walker
swalker at opensolaris.org
Fri Feb 8 06:42:28 PST 2008
On Feb 7, 2008 11:13 PM, David Korn <dgk at research.att.com> wrote:
> cc: swalker at opensolaris.org
> Subject: Re: [ksh93-integration-discuss] printf syntax and /sbin/sh compatibility
> --------
>
>
> > I just ran into an odd behaviour tonight (see bug
> > http://defect.opensolaris.org/bz/show_bug.cgi?id=502).
> >
> > The following script:
> >
> > printf "\n----------------------\n"
> > printf " IP configuration \n"
> > printf "----------------------\n\n"
> >
> > ...works under ye olde /sbin/sh (bourne shell), but fails with
> > "unknown option" under ksh93.
> >
> > Since I'm rather daft about some nuances of shell syntax, can someone
> > explain this to me?
> >
> > Cheers,
> > --
> > Shawn Walker, Software and Systems Analyst
> > http://binarycrusader.blogspot.com/
> >
> > "To err is human -- and to blame it on a computer is even more so." -
> > Robert Orben
>
> This is not a defect. If the first argument a command begins with a -
> it is treated as an option, not an argument. The operand -- indicates
> end of options.
>
> Change
> printf "----------------------\n\n"
> to
> printf -- "----------------------\n\n"
In this case, it isn't a script I wrote.
It's part of a shell script that is used during a driver install for a
Marvell Yukon Gigabit Ehternet Adapter.
Sadly, Solaris' version of bourne shell? /sbin/sh allows the "bad
syntax" I mentioned above.
I wonder if some sort of compatibility mode can be achieved for
bourne's printf syntax.
Cheers,
--
Shawn Walker, Software and Systems Analyst
http://binarycrusader.blogspot.com/
"To err is human -- and to blame it on a computer is even more so." -
Robert Orben
More information about the ksh93-integration-discuss
mailing list