Bug #358
openSolaris does not accept -n option in echo command
| Status: | New | Start date: | 07/21/2012 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned To: | % Done: | 0% | ||
| Category: | - | Estimated time: | 1.00 hour | |
| Target version: | - | |||
| Duration: |
Description
On openSolaris, echo -n does not work. The echo command simply ignores the option and prints -n.
From the man file on openSolaris one reads:
Portable applications should not use -n (as the first argu-
ment) or escape sequences.
The printf(1) utility can be used portably to emulate any of
the traditional behaviors of the echo utility as follows:
o The Solaris 2.6 operating environment or compatible
version's /usr/bin/echo is equivalent to:
printf "%b\n" "$*"
o The /usr/ucb/echo is equivalent to:
if [ "X$1" = "X-n" ]
then
shift
printf "%s" "$*"
else
printf "%s\n" "$*"
fi
New applications are encouraged to use printf instead of
echo.
We should probably use printf instead of echo to get things working properly on openSolaris. Note that this is only cosmetics anyhow.
Recurrence
No recurrence.