Shells and built-ins

Shells and built-ins

Post by James J. Yort » Fri, 31 Jan 1992 23:35:50

|> I have a problem which I dont understand and am looking for
|> help.  I have a user who is running csh and the path is set
|> to use the version of echo whose syntax is 'echo -n abc'
|> rather than 'echo abc\c'.  Now this user invokes a shell script
|> whose first line is '#!/bin/ksh'.  In this script is the
|> command "echo 'abc\c'".  And the problem is that the echo produces
|> the string abc\c.  In the ksh echo is a built-in using the \c notation.
|> So how come it aint doing it?
|> Any ideas?  Appears invoking the shell is not having it grab
|> the built-ins.
|>  Will Renkel - Motorola - Cellular

I maintain ksh (88f) at the same facility where Will works and have
talked to him off-line about this.

No problem exists.  Ksh is using the builtin.  On our system, Sun OS 4.0.3,
it appears the echo builtin can behave differently depending on where
your $PATH has /bin specified.

The ksh documentation mentions something about this too:

Quote:>ECHO_N  Set when /bin/echo -n does not echo at all.  This causes the
>            echo builtin to handle echo like BSD echo when at run time
>            the shell would find echo in the /bin directory.

Again, no problem exists.

James J. Yorton                       | Telephone:  +1 708-632-6695
Motorola Inc., General Systems Sector |
Radio Telephone Systems Group         | uucp:      ...!uunet!motcid!yorton

Mail Drop:  IL27-3227                 |
Arlington Heights, IL  60004          |


Shells and built-ins

Post by Donn Ca » Sat, 01 Feb 1992 09:40:06

Quote:>No problem exists.  Ksh is using the builtin.  On our system, Sun OS 4.0.3,
>it appears the echo builtin can behave differently depending on where
>your $PATH has /bin specified.

Well, the echo builtin certainly behaves differently on one of our systems,
depending on $PATH.  This only happens on our RISC Ultrix (4.2) system, and
it only affects "echo", not "print".  I was mystified, but now I suppose that
it must have something to do with the above-mentioned hack.

; ksh
$ Version 11/16/88                
$ echo $PATH
Memory fault

        Donn Cave, University Computing Services, University of Washington


1. shell built ins

hi everyone,

i still try to get which done so that it knows about the shell built-ins
like exit etc...
i worked on it but still it won't run. i am pretty sure it is just a small
mistake. please help me out here.

thanks a lot

($1 2> /dev/null ) && (echo 'built in shell' :exit 0)
echo x
PATH=/bin:/usr bin
case $# in
0)      echo 'Usage: which command' 1>&2; exit 2
                for i in `echo $opath | sed  's/^:/.:/
                                                             s/:/ /g'`
                      if test -x $i/$1             # this is /bin/test
                          then                         # or /usr/bin/test
               echo $i/$1
               exit 0              # found it
exit 1                              #not found

2. machine crashing complaining about: lm_get_me

3. What's 'side effects' of Ksh built-ins?

4. Problems with xdm and Bootsys 0.4a

5. Subject: Ksh93 question: special built-ins: why are they special?

6. search by size

7. Compare file modification date using tcsh built-ins

8. history/alias

9. Matrox Mystique ands X.

10. i want to build a linux shell from scratch

11. Problem connecting RH7 from SSH Secure Shell 3.0.0 (Build 199) on NT.

12. c shell script; Howto use environement variables to build environment variables and take their value

13. why is "cd" built into the shell?