On Wed, 12 Jun 2002, Mike Martin wrote: > --- John Horne <[EMAIL PROTECTED]> wrote: > Hello, > > > > Anyone want to tell me why a semicolon at the beginning of a shell > > line > > causes an error? > > > > The following work fine under sh, bash, ksh and csh (redhat 7.0): > > > > date;ls -l > > date;ls -l; > > > > but ';date;ls -l' fails under all shells except csh with the error: > > > > sh: syntax error near unexpected token `;d' > > bash: syntax error near unexpected token `;d' > > pdksh: syntax error: `;' unexpected > > > > I see no real reason for this, and a semicolon at the end of the > > line seems > > to be accepted okay. Just curious. > > > > > > > > Regards, > > > > John. > > Not certain about this but probably to do with the fact that the ; > usually acts as as a command terminator.
no, it normally acts as a command *separator* since, if you type $ date ; ls there is no need to terminate the *second* command. a better guess would be that ";" does not correspond to a legitimate command, function or alias that bash is prepared to recognize. technically, i guess there's no reason why bash shouldn't be able to handle a leading ";" -- it just doesn't. so the simple answer here might just be: "because". :-) rday _______________________________________________ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list