You wrote:
> It appears that ksh93 is not respecting the \c (suppress trailing
> newline) in an echo statement - for example:
> 
> #!/bin/ksh
> echo "enter a number => \c"

> output is:
> enter a number => \c

This is by design. See the man page. In particular:
   echo [ arg ... ]

   When  the  first  arg  does  not begin with a -, and none of the
   arguments contain a \, then echo prints each  of  its  arguments
   separated  by  a space and terminated by a new-line.  Otherwise,
   the behavior of echo is system dependent  and  print  or  printf
   described  below  should  be  used.   See  echo(1) for usage and
   description.

echo has always varied between systems. It is an old System V/BSD
difference. If you have access to Solaris, look at the difference
between /usr/ucb/echo and /usr/bin/echo. This is why the print command
was introduced. printf is also a good option if you want consistent
behaviour.

> Note that "echo -n "enter a number => " DOES work, as does coreutils
> echo.

As far as I can tell, coreutils behaves the same as ksh:

$ /bin/echo "enter a number => \c"
enter a number => \c

Perhaps it is also system dependant. bash's echo also behaves like this
by default.  zsh defaults to the opposite. But both bash and zsh have
an option.

Oliver


This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to