Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 May 1995 14:15:02 -0700 (PDT)
From:      "Rodney W. Grimes" <rgrimes@gndrsh.aac.dev.com>
To:        wsantee@wsantee.oz.net (Wes Santee)
Cc:        freebsd-ports@FreeBSD.org
Subject:   Re: pdksh choading on exec command
Message-ID:  <199505092115.OAA05574@gndrsh.aac.dev.com>
In-Reply-To: <199505092035.NAA01005@wsantee.oz.net> from "Wes Santee" at May 9, 95 01:35:12 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> > > [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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199505092115.OAA05574>