Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

syntax error at line 1: `zero byte' unexpected in ksh 93u+ 2012-08-01

1,784 views
Skip to first unread message

Shurik

unread,
Aug 17, 2014, 12:12:05 PM8/17/14
to
Hi

I have the below simple script that is working in ksh 93t+ version but failed in version 93u+

#!/bin/ksh

init_args $*

init_args()
{
echo "before"
. my_test_file
echo "after"
}

I got the below error

syntax error at line 1: `zero byte' unexpected

Kaz Kylheku

unread,
Aug 17, 2014, 12:55:22 PM8/17/14
to
Is this in the above script or in the "my_test_file" script?

If it's the above script, line 1 is the #!/bin/ksh line.

Maybe you have a null byte in that line. The kernel doesn't seem to mind; it
opens the interpreter fine and hands it the script. But then ksh has to read
that script, including the #!/bin/ksh comment.

Maybe the lexical scanning logic in that shell doesn't like null bytes in the
syntax, even if they are commented out?

If you run "od -t x1 <above-script>", do you see any null bytes?

frank.w...@gmail.com

unread,
Aug 17, 2014, 3:12:09 PM8/17/14
to
From Shurik:
>init_args $*
>
>init_args()
>{

I have not used 'ksh' and know nothing about it - does
it permit the use of a function above its definition?

Frank

Janis Papanagnou

unread,
Aug 17, 2014, 5:18:56 PM8/17/14
to
No, it does not permit a function call before its function definition.
So after the 'zero byte' problem is fixed the OP should get an error
init_args: not found [No such file or directory]

BTW, I wonder why it works with the OP's ksh93t+, in mine it doesn't.

Janis

>
> Frank

0 new messages