[comp.unix.xenix] Shell Script question

mcoffey@mcoffey.aix.kingston.ibm.com (Michael Coffey) (03/21/90)

I am using XENIX 2.3.1 on an AT clone. I like using the c-shell, and most
of my shell scripts are written for it. I have a bourne shell script that I
would like to use but don't have time to convert it to C-Shell. I thought
having line 1 of the script something like #!/bin/sh
would cause the bourne shell to be used. The script only works if I issue 
sh script however. Also if I am in bourne shell I have to enter
csh script to run my C-Shell scripts, even though line one of the scripts
is #!/bin/csh . On my AIX systems at work the shells execute whatever
program is specified in line 1 of the script (#!/bin/sh, #!/bin/awk, etc).
Is this a known problem/feature of XENIX?
Thanks,
...Mike



Michael K. Coffey ------ (mcoffey@mcoffey.aix.kingston.ibm.com) --------------
 ..UUnet!ibmps2!aix!mcoffey | For God so loved the world that he gave his one
AIX Kernel I/O Development  | and only son, that whoever believes in him shall
IBM Kingston, NY            | not perish but have eternal life.  - John 3:16 -

lbr@holos0.uucp (Len Reed) (03/22/90)

In article <4571@ibmpa.UUCP> mcoffey@mcoffey.aix.kingston.ibm.com (Michael Coffey) writes:
>I am using XENIX 2.3.1 on an AT clone. I like using the c-shell, and most
>of my shell scripts are written for it. I have a bourne shell script that I
>would like to use but don't have time to convert it to C-Shell. I thought
>having line 1 of the script something like #!/bin/sh
>would cause the bourne shell to be used.

For some stupid reason SCO never incorporated this convention into either
their csh or Bourne shell.  It would be nice to tag awk, perl, sed, etc.
scripts this way.

The SCO csh looks at the first line of a script.  If it starts with '#' it's
a csh script.  Therefore, your "#!/bin/sh" causes this to be run by the csh!
I put a single line containing only a colon at the start of each of
my Bourne shells scripts, and they run fine out of the csh or Bourne shell.

Running a csh script from a Bourne shell is messier.  You have to explicitly
run the csh, as in "csh script_name".
-- 
Len Reed
Holos Software, Inc.
Voice: (404) 496-1358
UUCP: ...!gatech!holos0!lbr

davidsen@sixhub.UUCP (Wm E. Davidsen Jr) (03/25/90)

In article <1990Mar21.170124.1365@holos0.uucp> lbr@holos0.UUCP (Len Reed) writes:

| For some stupid reason SCO never incorporated this convention into either
| their csh or Bourne shell.  It would be nice to tag awk, perl, sed, etc.
| scripts this way.

  I seem to recall that this is in the kernel, a fair reason for not
adding it to a shell. I thought that there was a convention that looked
something like
	:uses /bin/awk
at the start of a script which WAS recognized, but I can't get it to
work now, so I may be dreaming.
-- 
bill davidsen - davidsen@sixhub.uucp (uunet!crdgw1!sixhub!davidsen)
    sysop *IX BBS and Public Access UNIX
    moderator of comp.binaries.ibm.pc and 80386 mailing list
"Stupidity, like virtue, is its own reward" -me