🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #1071

Strange behavior with functions

#1071
From: trost%REED.BITNET
Date: Wed, 20 Dec 1989 19:10
129 lines
4717 bytes
Heh, this should cover it.  This was run on the DECstation --- which
now seems to be running differently than when I first posted about this.

bash$ cat /etc/motd
Ultrix Worksystem V2.0 (Rev. 7) System #1: Tue Aug 29 22:41:48 EDT 1989
I would encourage everyone to not rlogin to this machine from the DECstations
to do things, but instead do stuff from the machine you're on.  If that is
impossible for some reason, fix it, or send mail to trost repeatedly (but not
too often) until he does.
bash$ ./rv /etc/motd
Read: Ultrix Worksystem V2.0 (Rev. 7) System #1: Tue Aug 29 22:41:48 EDT 1989
Read: I would encourage everyone to not rlogin to this machine from the DECstati
Read: to do things, but instead do stuff from the machine you're on. If that is
Read: impossible for some reason, fix it, or send mail to trost repeatedly (but
Read: too often) until he does.
empty???
longjmp botch

bash$ ./rv < /etc/motd
Read: Ultrix Worksystem V2.0 (Rev. 7) System #1: Tue Aug 29 22:41:48 EDT 1989
Read: I would encourage everyone to not rlogin to this machine from the DECstati
Read: to do things, but instead do stuff from the machine you're on. If that is
Read: impossible for some reason, fix it, or send mail to trost repeatedly (but
Read: too often) until he does.
empty???
longjmp botch

bash$ ./gurk < /etc/motd
Read Ultrix Worksystem V2.0 (Rev. 7) System #1: Tue Aug 29 22:41:48 EDT 1989
Read I would encourage everyone to not rlogin to this machine from the DECstatio
Read to do things, but instead do stuff from the machine you're on. If that is
Read impossible for some reason, fix it, or send mail to trost repeatedly (but n
Read too often) until he does.
empty???
too often) until he does.
impossible for some reason, fix it, or send mail to trost repeatedly (but not
to do things, but instead do stuff from the machine you're on. If that is
I would encourage everyone to not rlogin to this machine from the DECstations
bash$ ./gurk /etc/motd
Read Ultrix Worksystem V2.0 (Rev. 7) System #1: Tue Aug 29 22:41:48 EDT 1989
Read I would encourage everyone to not rlogin to this machine from the DECstatio
Read to do things, but instead do stuff from the machine you're on. If that is
Read impossible for some reason, fix it, or send mail to trost repeatedly (but n
Read too often) until he does.
empty???
too often) until he does.
impossible for some reason, fix it, or send mail to trost repeatedly (but not
to do things, but instead do stuff from the machine you're on. If that is
I would encourage everyone to not rlogin to this machine from the DECstations
longjmp botch

bash$ cat rv
   rv () {
           [ $# = 0 ] && {
                   # Call this block A
                   local line=empty\?\?\?
                   read line || return
                   echo Read: "$line" 2>&1
                   rv
                   echo "$line"
                   # end A
                   return
           }
           # Call this block B
           local f=$1
           shift
           [ $# = 0 ] || rv $*
           rv < $f
   }

   rv $*
bash$ cat gurk
#!/local/bin/bash

rv () {
        [ $# = 0 ] || {
                local f=$1
                shift
                [ $# = 0 ] || rv $*
                rv < $f
                return 0
        }
        local line=empty\?\?\?
        read line || return
        echo Read "$line" 2>&1
        rv
        echo "$line"
}

rv $*
bash$ set
_=/etc/motd
OLDPWD=/bassoon/u/ss/trost
EUID=236
UID=236
HISTSIZE=500
HISTFILE=/u/ss/trost/.bash_history
BASH_VERSION=0.00.4
PWD=/tmp
MAILCHECK=60
IFS=

PS2=bash>
PS1=bash\$
VISUAL=/bin/ed
USER=trost
TTY=ttyp3
TEXINPUTS=.:/u/ss/trost/lib/tex:/usr/lib/tex/macros
TEXEDIT=/bin/ed
TERM=emacs
SHLVL=2
SHELL=/local/bin/bash
RNINIT=-i1 -T -hReferences -hMessage-Id -hlines -e -d/u/ss/trost/.news
PRINTER=katy
PATH=/u/ss/trost/.bin/vishnu:/u/ss/trost/.bin:/local/bin:/local/bin/xclients:/us
PAGER=less
MAIL=/u/ss/trost/.mail/inbox:/u/ss/trost/.mail/root:/u/ss/trost/.mail/twatch:/et
LESS=sMqtwp
JOVERC=/u/ss/trost/.joverc
HUNT=name=default,mapkey=;G
HOST=vishnu
HOME=/u/ss/trost
EDITOR=/bin/ed
DISPLAY=bassoon:0
COLS=22
BASH=/local/bin/bash
TERMCAP=emacs:co#80:tc=unknown:
EMACS=t
bash$
Technical Details
Message-ID: <8912201910.AA16864@.reed.bitnet>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!MITVMA.MIT.EDU!trost%REED.BITNET

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!MITVMA.MIT.EDU!trost%REED.BITNET
From: trost%REED.BITNET@MITVMA.MIT.EDU
Newsgroups: gnu.bash.bug
Subject: Strange behavior with functions
Message-ID: <8912201910.AA16864@.reed.bitnet>
Date: 20 Dec 89 19:10:33 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 129