Echo? What echo? Korn shell 88

FISH at LIVERPOOL.AC.UK FISH at LIVERPOOL.AC.UK
Fri Oct 19 23:01:54 AEST 1990


I have recently discovered a problem with ksh88. The print command has a flag
-s that allows you to place things into the history file, i.e.

print -s Hello there

will place "Hello there" in the history file. The manual claims that echo
uses the echo program which means that echo -s should print the string -s.
For reasons explained below this is the preferred behaviour.
However, it would appear that echo has been aliased to print, even though the
manual would claim that this is not the case and echo is /bin/echo like in the
Bourne shell and earlier versions of the K shell.

Has anyone had this problem and how did you crack it?

alias -x echo /bin/echo dosen't work and gives an error

neither does defining a function although you can do this without an error
message.

Background:

I have been trying to write a simple training manual for users that has
a worked example that uses the flag -s. This is to show some of the
dangers in using test with things like [ -s = -s  ], which works in            n
some implementations and not others. Unfortunately the way round it I discuss
using `if echo $arg | grep -s -e -s' no longer works if echo -s dosen't send
-s to stdout. I don't want to use the [[ ]] construct because we don't have
ksh88 across the whole site, even though I recomend its use if available.

Thanks in advance. Any ideas?

Francis Fish
Programmer / Analyst
Liverpool University Computer Laboratory
fish at uk.ac.liverpool



More information about the Comp.unix.shell mailing list