Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!aplcen!akbloom From: akbloom@aplcen.apl.jhu.edu (Keith Bloom) Newsgroups: comp.unix.questions Subject: BSD sh vs. System V sh Keywords: colon, #!, if statement Message-ID: <1005@aplcen.apl.jhu.edu> Date: 11 Apr 89 02:33:57 GMT Organization: Johns Hopkins University, Laurel, MD Lines: 22 I use a SysV clone (Venix) and BSD 4.2. My login shell on both systems is Bourne shell. Recently I took a shell script which worked fine under Venix and moved it to BSD. When I ran the script, I got the message "if: Expression syntax" Based on a hunch (recollections of other scripts) I inserted a ":" at the top of the script (before the "if"). It worked. I also tried inserting "#! /bin/sh", which also worked. So the problem is solved, but I'd still like to understand why this was necessary. Everything I've read about the : says simply that it returns true - and so it does. But apparently that's not all it does. Also, are there any differences between using : and using #! /bin/sh ? (Before you tell me to RTFM: the BSD documentation I inherited is very disorganized, and parts of it are not there at all) -- Keith Bloom UUCP: {rutgers|ames|uunet}!mimsy!apclen!akbloom Internet: akbloom@aplcen.apl.jhu.edu