bourne and korn shell incompatibilities

Marnix van Ammers vanam at pttesac.UUCP
Sun Jan 31 15:01:29 AEST 1988


Here's an incompatibility between ksh and sh.  With ksh, this fails
on both the UNIX-PC and the 3B20 if there's more than one *.c file.
Works OK with the bourne shell.

    if [ -f *.c ];then
      echo "There's a C file in the current directory."
    else
      echo "There are no C files in the current directory."
    fi

Apparently the bourne shell permits a test such as

    if [ -f abc.c def.c xyz.c ]

probably by throwing away the def.c and xyz.c .  The korn
shell calls it a syntax error and fails the test even if
the first file exists.

I realize that the bourne shell never advertised that multiple
arguments were allowed, but it worked, I used it, and now I have a
handful of fairly large and often used scripts which I'd like to
get working under the ksh.

Does anyone have any recommendations as to the best way to
make these scripts palatable to the korn shell?


-- 
Marnix (ain't unix!) A.  van\ Ammers		Work: (415) 545-8334
Home: (707) 644-9781				CEO: MAVANAMMERS:UNIX
WORK UUCP: {ihnp4|ptsfa}!pttesac!vanam		CIS: 70027,70
HOME UUCP: pttesac!Marnix!vanam 



More information about the Comp.unix.questions mailing list