🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.unix.shell
3 messages
3 total messages Started by FISH Fri, 19 Oct 1990 13:01
Echo? What echo? Korn shell 88
#1554
Author: FISH
Date: Fri, 19 Oct 1990 13:01
35 lines
1766 bytes
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@uk.ac.liverpool
Re: Echo? What echo? Korn shell 88
#1557
Author: Jim Burns
Date: Sat, 20 Oct 1990 13:32
12 lines
787 bytes
in article <90292.140155FISH@LIVERPOOL.AC.UK>, FISH@LIVERPOOL.AC.UK says:

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

It will if you include the '=':

alias -x echo=/bin/echo
-- 
BURNS,JIM
Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a
Internet: gt0178a@prism.gatech.edu
Re: Echo? What echo? Korn shell 88
#1584
Author: L. Mark Larsen
Date: Sat, 20 Oct 1990 20:03
26 lines
1489 bytes
In article <90292.140155FISH@LIVERPOOL.AC.UK>, FISH@LIVERPOOL.AC.UK writes:
> 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.

I tried this with ksh86, ksh88, ksh88e and "echo -s" prints "-s".  Of course,
it is possible that your version of ksh was compiled to exclude echo - it
is an option afterall.  If so, there might be an alias (poorly defined) for it
in your environment.  Try "alias echo" or "whence -v echo" to see.  A proper
alias for echo (if needed) is:

	alias echo='print -'

The '-' ends the argument string for print so, with this alias, your attempt
to do "echo -s" will work as expected.  No need to call /bin/echo.

> Thanks in advance. Any ideas?
> 
> Francis Fish

L. Mark Larsen
lml@atlas.att.com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads