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" David Korn dgk at research.att.com