SUMMARY: Syntax error at line 1: "XX" Unexpected

From: Nancy Voorhis (
Date: Thu Mar 11 1999 - 11:06:46 CST


Thanks to all who responded.

The original posting is below, but the problem was a system not
booting properly and getting the message: "Syntax error at line 1:
"XX" Unexpected" upon running boot scripts. The message was
reported for many, many commands so wasn't related to a specific

The solution was a corrupted file (0 bytes in size).

The trick was finding it and the 2nd trick was getting a good one in
place, as in my case I had no backup tapes and no install media
immediately handy (shame, shame, but long story which I won't go

Most people suggested some alternate way to boot: off CD,
orboot -v or boot -s. I used the CD boot solution.
I then fscked and mounted my "real" / and /usr disks to /mnt.
I then copied the from the CD boot to the "real" /usr/lib
location, mounted under the CD boot as /mnt/usr.

To find the corrupted file I used my brain and checked the most
obvious library I could think of and was lucky. A better
all around approach was suggested by Mark Ashley and used 'ls' to
find the most recently used and modified things in the file system. I
wasn't able to do 'file' command as it also was failing:

"Boot off CDROM, mount the HDD on /tmp/mnt and cd /tmp/mnt/etc/init.d

Do a ls -alut and investigate the last accessed file. Likely to be
the script at fault.

Execute "file *" and see if there are non sh files... sorta useful,
depends on your machine. Note this screws up the ls -alut output as it
messes with the inode access time.

Doing a ls -almt in that directory will show any recently changed

Mark Ashley

A side confession is this wasn't on a Sun box, but a DG box, so I've
substituted Sun "language" to describe the solution. In reality, I
booted using the DG's stand-alone sysadm mode which didn't require a
CD more like the earlier SunOS boots to the swap partition. Anyway,
I hope I've translated correctly and gotten the point across. The
general procedure on any Unix system would have been the same: boot
to something that works, fsck and mount the real file systems and use
ls to figure out what changed recently, then put a good copy in
place. I also now remember the last time I encountered something
similar and it was on a Sun box about 5 years ago. I had a CD then :)

Thanks again for all the responses,

Nancy Voorhis
Unix System Administrator
VoorTech Consulting
Northwood, New Hampshire

------- Orginal Message Follows -------


I have a system that won't boot properly, failing as it tries to
execute stty, but followed by a failure to execute many commands with
the following type of error:
 sh: Syntax error at line 1: "(" unexpected

but the unexpected character is different depending on what file I try
to execute (^P, or ^?ELF, or whateverit happens to be).

The problem started after a power crash and appeared in the attempted
reboot so I think the likely scenario is that something is corrupt but
what? I can boot to singler user mode and can fsck the disks okay.

Commands like cd, ls, pwd, ls, fsck, cat execute okay. Commands like
file, df, more, and many, many others don't execute okay.

I am looking for help on to most likely places to look for trouble. Is
this an /etc/magic problem? A shell (sh) corrupt problem? A corrupt
library problem? If library, what would be the most likely libraries
to hunt down?

 I have super limited tools as I am in a situation with no other
 system easy
to compare to and no easy way to get files onto the botched system.

Any pointers would be appreciated. I feel like I've seen this problem I am hoping someone else has too :)

Thanks for any help in advance,
Nancy Voorhis

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:16 CDT