From owner-freebsd-ports Tue May 9 14:15:25 1995 Return-Path: ports-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id OAA26406 for ports-outgoing; Tue, 9 May 1995 14:15:25 -0700 Received: from gndrsh.aac.dev.com (gndrsh.aac.dev.com [198.145.92.241]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id OAA26400 for ; Tue, 9 May 1995 14:15:18 -0700 Received: (from rgrimes@localhost) by gndrsh.aac.dev.com (8.6.11/8.6.9) id OAA05574; Tue, 9 May 1995 14:15:03 -0700 From: "Rodney W. Grimes" Message-Id: <199505092115.OAA05574@gndrsh.aac.dev.com> Subject: Re: pdksh choading on exec command To: wsantee@wsantee.oz.net (Wes Santee) Date: Tue, 9 May 1995 14:15:02 -0700 (PDT) Cc: freebsd-ports@FreeBSD.org In-Reply-To: <199505092035.NAA01005@wsantee.oz.net> from "Wes Santee" at May 9, 95 01:35:12 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 2060 Sender: ports-owner@FreeBSD.org Precedence: bulk > > > > [pdksh dying on 'exec'ed shell scripts] > > > > [reason why direct ivocation of exec logged me out] > > > > What happens if you type /usr/bin/clear? > > [wsantee:~] 4 $ /usr/bin/clear > /usr/bin/clear: 21: syntax error: Bad substitution Humm.... very interesting, line 21 of /usr/bin/clear is a COMMENT!!! > [wsantee:~] 5 $ cat /usr/bin/clear > #!/bin/sh - > # lots of comments > exec tput clear > > [wsantee:~] 5 $ sh `exec tput clear` > (screen clears) What I would expect to happen. > > [wsantee:~] 6 $ ksh `exec tput clear` > (screen clears) > : No such file or directory What I would expect to happen. ksh is trying to evaluate the strings ``^[[H^[[2J'' > > [wsantee:~] 7 $ ksh `exec tput clear` 2> stderr.txt > [wsantee:~] 8 $ cat stderr.txt > ksh: ^[[;H^[[2J: No such file or directory You should not be evaluating the ``exec tput clear'' with back quotes, you should do this commands: sh -c "exec tput clear" > > Actually the behavior for commands 6-8 was more expected than command > 5 (i.e. no error message). I would have thought that sh would try to > execute the clear screen sequence the same as ksh (and csh, although > not shown above) and error out because the ansi sequence isn't a > command. You run the back quoted command first, causing the screen to clear, then take the stdout of that command and send it back up to the command before the backquotes. > The next step for me is to blow away my login environment and see how > bare ksh functions. If that doesn't rat out the error, I guess it's > time to go to the source. Thanks for all your help. Good luck! > BTW, if the Reply-To address is munged again, please let me know. It > was quite a surprise to me to find out the header was damaged when all > the bouncer addresses I tested mail with said everything was just > fine. I've done what I can to fix the problem. It looked fine this time! -- Rod Grimes rgrimes@gndrsh.aac.dev.com Accurate Automation Company Custom computers for FreeBSD