This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tow tpyoes
[metaconfig.git] / U / modified / sh.U
1 ?RCS: $Id: sh.U,v 3.0.1.1 1997/02/28 16:20:13 ram Exp $
2 ?RCS:
3 ?RCS: Copyright (c) 1997, Chip Salzenberg
4 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
5 ?RCS: 
6 ?RCS: You may redistribute only under the terms of the Artistic Licence,
7 ?RCS: as specified in the README file that comes with the distribution.
8 ?RCS: You may reuse parts of this distribution only within the terms of
9 ?RCS: that same Artistic Licence; a copy of which may be found at the root
10 ?RCS: of the source tree for dist 3.0.
11 ?RCS: 
12 ?RCS: $Log: sh.U,v $
13 ?RCS: Revision 3.0.1.1  1997/02/28  16:20:13  ram
14 ?RCS: patch61: created
15 ?RCS:
16 ?MAKE:sh: Head
17 ?MAKE:  -pick wipe $@ %<
18 ?S:sh:
19 ?S:     This variable contains the full pathname of the shell used
20 ?S:     on this system to execute Bourne shell scripts.  Usually, this will be
21 ?S:     /bin/sh, though it's possible that some systems will have /bin/ksh,
22 ?S:     /bin/pdksh, /bin/ash, /bin/bash, or even something such as
23 ?S:     D:/bin/sh.exe.
24 ?S:     This unit comes before Options.U, so you can't set sh with a -D
25 ?S:     option, though you can override this (and startsh)
26 ?S:     with -O -Dsh=/bin/whatever -Dstartsh=whatever
27 ?S:.
28 ?C:SH_PATH:
29 ?C:     This symbol contains the full pathname to the shell used on this
30 ?C:     on this system to execute Bourne shell scripts.  Usually, this will be
31 ?C:     /bin/sh, though it's possible that some systems will have /bin/ksh,
32 ?C:     /bin/pdksh, /bin/ash, /bin/bash, or even something such as
33 ?C:     D:/bin/sh.exe.
34 ?C:.
35 ?H:#define SH_PATH "$sh"  /**/
36 ?H:.
37 ?T:xxx try pth p SYSTYPE
38 ?LINT:extern maintloc maintname _exe
39 ?X:
40 ?X: Be quiet unless something unusual happens because this gets
41 ?X: loaded up even before options are processed.
42 ?X:     Can't use ./loc because that depends on startsh, which, in turn
43 ?X:     depends on this unit.
44 ?X:
45 : Find the basic shell for Bourne shell scripts
46 case "$sh" in
47 '')
48 ?X: SYSTYPE is for some older MIPS systems. 
49 ?X: I do not know if it is still needed.
50         case "$SYSTYPE" in
51         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
52         *) xxx='/bin/sh';;
53         esac
54         if test -f "$xxx"; then
55                 sh="$xxx"
56         else
57                 : Build up a list and do a single loop so we can 'break' out.
58                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
59                 for xxx in sh bash ksh pdksh ash; do
60                         for p in $pth; do
61                                 try="$try ${p}/${xxx}"
62                         done
63                 done
64                 for xxx in $try; do
65                         if test -f "$xxx"; then
66                                 sh="$xxx";
67                                 break
68                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
69                                 sh="$xxx";
70                                 break
71                         elif test -f "$xxx.exe"; then
72                                 sh="$xxx";
73                                 break
74                         fi
75                 done
76         fi
77         ;;
78 esac
79
80 ?X: fd 4 isn't open yet...
81 case "$sh" in
82 '')     cat >&2 <<EOM
83 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
84
85 Usually it's in /bin/sh.  How did you even get this far?
86 Please contact me (<$maintname>) at <$maintloc> and 
87 we'll try to straighten this all out.
88 EOM
89         exit 1
90         ;;
91 esac
92