*BSD News Article 72639


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.mel.connect.com.au!news.uwa.edu.au!disco.iinet.net.au!news.uoregon.edu!hpg30a.csc.cuhk.hk!news.cuhk.edu.hk!agate!theos.com!riscan.riscan.com!van.istar!van-bc!unixg.ubc.ca!aurora.cs.athabascau.ca!sgigate.sgi.com!spool.mu.edu!howland.reston.ans.net!newsfeed.internetmci.com!hunter.premier.net!netnews.worldnet.att.net!ix.netcom.com!netcom.net.uk!dispatch.news.demon.net!demon!awfulhak.demon.co.uk!awfulhak.demon.co.uk!a
wfulhak.demon.co.uk!not-for-mail
From: brian@awfulhak.demon.co.uk (Brian Somers)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: FreeBSD cmd line editor / text editor recommends?
Date: 29 Jun 1996 23:07:41 -0500
Organization: Coverform Ltd.
Lines: 39
Message-ID: <4r4uid$11n@anorak.coverform.lan>
References: <4psnen$p9h@hermes.athenet.net> <87g27wffhr.fsf@plm.xs4all.nl> <4qupu8$9p@uriah.heep.sax.de>
NNTP-Posting-Host: localhost.coverform.lan
X-NNTP-Posting-Host: awfulhak.demon.co.uk
X-Newsreader: TIN [version 1.2 PL2]

J Wunsch (j@uriah.heep.sax.de) wrote:
: brian@awfulhak.demon.co.uk (Brian Somers) wrote:

: > I assert that you are wrong.
: > 
: > answer=
: > echo ksh | read answer
: > test -n "$answer" && { echo $answer; exit; }
: > answer=notbash
: > answer=\${answer#not}
: > answer=`(eval echo $answer) 2>/dev/null`
: > test -z "$answer" && echo sh || echo bash
: > 
: > This script only tests for ksh, sh and bash.  If zsh is both bourne
: > and ksh compatible, what does this script say when run ?


: Shell		Answer

: bsh		sh		(True Bourne Shell, SVR4)
: ash		sh		(Almquist Shell, /bin/sh in 4.4BSD)
: ksh		ksh		(True Korn Shell, SVR4)
: pdksh		bash		(public domain Korn Shell)
: bash		bash
: zsh		ksh

Hmmm, if zsh says that, I'll have to give it a go (I like the fact that
the real ksh inlines the last bit of a pipe).  I'll change my script
to do some of the stuff with {} so that it can identify zsh.  I've got
pdksh now too so I'll see if I can identify that too.  Any advances ?
Of course,

    ps opid,command | grep " *$pid " | sed 's/.* //'

doesn't count !

--
Brian <brian@awfulhak.demon.co.uk>
Don't _EVER_ lose your sense of humour....