Linux MS DOS discussions
 help / color / mirror / Atom feed
* Syntax error: Bad substitution
@ 2006-10-28  3:32 Ralph Alvy
  2006-10-28  6:22 ` Ralph Alvy
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Ralph Alvy @ 2006-10-28  3:32 UTC (permalink / raw)
  To: linux-msdos

I'm getting the following error when running dosemu 1.2.2 under a newly
installed Kubuntu 6.10:

./xdosemu: 86: Syntax error: Bad substitution

What might be going on here?



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-10-28  3:32 Syntax error: Bad substitution Ralph Alvy
@ 2006-10-28  6:22 ` Ralph Alvy
  2006-10-28 16:57 ` Ralph Alvy
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 17+ messages in thread
From: Ralph Alvy @ 2006-10-28  6:22 UTC (permalink / raw)
  To: linux-msdos

Ralph Alvy wrote:

> I'm getting the following error when running dosemu 1.2.2 under a newly
> installed Kubuntu 6.10:
> 
> ./xdosemu: 86: Syntax error: Bad substitution
> 
> What might be going on here?

Here are the last few lines of 'strace xdosemu':

fcntl64(10, F_SETFD, FD_CLOEXEC)        = 0
rt_sigaction(SIGINT, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {0x8054c2e, ~[RTMIN RT_1], 0}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL}, NULL, 8) = 0
rt_sigaction(SIGTERM, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL}, NULL, 8) = 0
read(10, "#! /bin/sh\n#\n# (C) Copyright 199"..., 8192) = 8192
write(2, "./xdosemu: 86: ", 15./xdosemu: 86: )         = 15
write(2, "Syntax error: Bad substitution", 30Syntax error: Bad substitution)
= 30
write(2, "\n", 1
)                       = 1
exit_group(2)                           = ?
Process 4840 detached



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-10-28  3:32 Syntax error: Bad substitution Ralph Alvy
  2006-10-28  6:22 ` Ralph Alvy
@ 2006-10-28 16:57 ` Ralph Alvy
  2006-10-28 22:56 ` Matthew Clarke
  2006-11-08 16:23 ` Ralph Alvy
  3 siblings, 0 replies; 17+ messages in thread
From: Ralph Alvy @ 2006-10-28 16:57 UTC (permalink / raw)
  To: linux-msdos

Ralph Alvy wrote:

> I'm getting the following error when running dosemu 1.2.2 under a newly
> installed Kubuntu 6.10:
> 
> ./xdosemu: 86: Syntax error: Bad substitution

Just compiled 1.3.3 and have the same problem here.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-10-28  3:32 Syntax error: Bad substitution Ralph Alvy
  2006-10-28  6:22 ` Ralph Alvy
  2006-10-28 16:57 ` Ralph Alvy
@ 2006-10-28 22:56 ` Matthew Clarke
  2006-10-29  0:14   ` Ralph Alvy
  2006-11-08 16:23 ` Ralph Alvy
  3 siblings, 1 reply; 17+ messages in thread
From: Matthew Clarke @ 2006-10-28 22:56 UTC (permalink / raw)
  To: Ralph Alvy; +Cc: linux-msdos

Fri, Oct 27, 2006 at 08:32:32PM -0700, Ralph Alvy may have written:

> I'm getting the following error when running dosemu 1.2.2 under a newly
> installed Kubuntu 6.10:
> 
> ./xdosemu: 86: Syntax error: Bad substitution
> 
> What might be going on here?

That's an error message from your shell.  It doesn't like something about
line 86 of the "xdosemu" shell script.  What does that line of that script
look like (I don't have a dosemu I can look at right now)?

To get more information, you could turn on the shell's tracing mode; for
Bourne shells, you can change:

	#! /bin/sh

to

	#! /bin/sh -x

or add a "set -x" command into the script.

Matt.
-- 
For a successful technology, reality must take precedence over public
relations, for nature cannot be fooled.
				-- Richard P. Feynman

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-10-28 22:56 ` Matthew Clarke
@ 2006-10-29  0:14   ` Ralph Alvy
  2006-10-29  0:41     ` Matthew Clarke
  0 siblings, 1 reply; 17+ messages in thread
From: Ralph Alvy @ 2006-10-29  0:14 UTC (permalink / raw)
  To: linux-msdos

Matthew Clarke wrote:

> Fri, Oct 27, 2006 at 08:32:32PM -0700, Ralph Alvy may have written:
> 
>> I'm getting the following error when running dosemu 1.2.2 under a newly
>> installed Kubuntu 6.10:
>> 
>> ./xdosemu: 86: Syntax error: Bad substitution
>> 
>> What might be going on here?
> 
> That's an error message from your shell.  It doesn't like something about
> line 86 of the "xdosemu" shell script.  What does that line of that script
> look like (I don't have a dosemu I can look at right now)?
> 
> To get more information, you could turn on the shell's tracing mode; for
> Bourne shells, you can change:
> 
> #! /bin/sh
> 
> to
> 
> #! /bin/sh -x
> 
> or add a "set -x" command into the script.
> 
> Matt.


84        -install)
85            INSTALL=1
86            if [ -n "$2" -a "${2:0:1}" != "-" ]; then
87              PROPRIETARY=$2


This is the only distro I've seen this happen, and I use dosemu 1.2.2 under
Slackware 11, Arch Current, Debian Testing, Mepis 6, and Fedora Core 5.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-10-29  0:14   ` Ralph Alvy
@ 2006-10-29  0:41     ` Matthew Clarke
  2006-10-29  1:17       ` Ralph Alvy
  2006-10-29 10:26       ` Bart Oldeman
  0 siblings, 2 replies; 17+ messages in thread
From: Matthew Clarke @ 2006-10-29  0:41 UTC (permalink / raw)
  To: Ralph Alvy; +Cc: linux-msdos

Sat, Oct 28, 2006 at 05:14:55PM -0700, Ralph Alvy may have written:

> Matthew Clarke wrote:
> 
> > Fri, Oct 27, 2006 at 08:32:32PM -0700, Ralph Alvy may have written:
> > 
> >> I'm getting the following error when running dosemu 1.2.2 under a newly
> >> installed Kubuntu 6.10:
> >> 
> >> ./xdosemu: 86: Syntax error: Bad substitution
> >> 
> >> What might be going on here?

[ snip ]

> 84        -install)
> 85            INSTALL=1
> 86            if [ -n "$2" -a "${2:0:1}" != "-" ]; then
> 87              PROPRIETARY=$2

Line 1 of the script says "#! /bin/sh", which implies that the code in the
script is written in the syntax understood by the Bourne shell.  However,
${2:0:1} is syntax for the GNU Bourne-again shell (AKA bash), not the
Bourne shell.  My guess is that your other distributions make /bin/sh a
symbolic link to /bin/bash, but that Kubuntu 6.10 points /bin/sh to some
other shell that understands Bourne shell syntax but not bash syntax, so
the other systems hide this error in the script but Kubuntu 6.10 doesn't.

If bash is installed as /bin/bash, you can change the first line of the
script to

	#! /bin/bash

to avoid the problem.

Matt.
-- 
For a successful technology, reality must take precedence over public
relations, for nature cannot be fooled.
				-- Richard P. Feynman

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-10-29  0:41     ` Matthew Clarke
@ 2006-10-29  1:17       ` Ralph Alvy
  2006-10-29 10:26       ` Bart Oldeman
  1 sibling, 0 replies; 17+ messages in thread
From: Ralph Alvy @ 2006-10-29  1:17 UTC (permalink / raw)
  To: linux-msdos

Matthew Clarke wrote:

> Sat, Oct 28, 2006 at 05:14:55PM -0700, Ralph Alvy may have written:
> 
>> Matthew Clarke wrote:
>> 
>> > Fri, Oct 27, 2006 at 08:32:32PM -0700, Ralph Alvy may have written:
>> > 
>> >> I'm getting the following error when running dosemu 1.2.2 under a
>> >> newly installed Kubuntu 6.10:
>> >> 
>> >> ./xdosemu: 86: Syntax error: Bad substitution
>> >> 
>> >> What might be going on here?
> 
> [ snip ]
> 
>> 84        -install)
>> 85            INSTALL=1
>> 86            if [ -n "$2" -a "${2:0:1}" != "-" ]; then
>> 87              PROPRIETARY=$2
> 
> Line 1 of the script says "#! /bin/sh", which implies that the code in the
> script is written in the syntax understood by the Bourne shell.  However,
> ${2:0:1} is syntax for the GNU Bourne-again shell (AKA bash), not the
> Bourne shell.  My guess is that your other distributions make /bin/sh a
> symbolic link to /bin/bash, but that Kubuntu 6.10 points /bin/sh to some
> other shell that understands Bourne shell syntax but not bash syntax, so
> the other systems hide this error in the script but Kubuntu 6.10 doesn't.
> 
> If bash is installed as /bin/bash, you can change the first line of the
> script to
> 
> #! /bin/bash
> 
> to avoid the problem.
> 
> Matt.

Thanks, Matt. This solved it nicely.



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-10-29  0:41     ` Matthew Clarke
  2006-10-29  1:17       ` Ralph Alvy
@ 2006-10-29 10:26       ` Bart Oldeman
  2006-10-29 17:08         ` Ralph Alvy
  2006-10-29 17:24         ` Ralph Alvy
  1 sibling, 2 replies; 17+ messages in thread
From: Bart Oldeman @ 2006-10-29 10:26 UTC (permalink / raw)
  To: Ralph Alvy, linux-msdos

On 10/29/06, Matthew Clarke <clamat@telus.net> wrote:
> Sat, Oct 28, 2006 at 05:14:55PM -0700, Ralph Alvy may have written:
>
> > 84        -install)
> > 85            INSTALL=1
> > 86            if [ -n "$2" -a "${2:0:1}" != "-" ]; then
> > 87              PROPRIETARY=$2
>
> If bash is installed as /bin/bash, you can change the first line of the
> script to
>
>         #! /bin/bash
>
> to avoid the problem.

You could also replace line 86 by:
            if [ -n "$2" -a -n "${2%%-*}" ]; then
which is portable to Bourne sh AFAIK (and a better solution for dosemu
itself -- some distributions don't like /bin/bash scripts).

Bart

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-10-29 10:26       ` Bart Oldeman
@ 2006-10-29 17:08         ` Ralph Alvy
  2006-10-29 17:24         ` Ralph Alvy
  1 sibling, 0 replies; 17+ messages in thread
From: Ralph Alvy @ 2006-10-29 17:08 UTC (permalink / raw)
  To: linux-msdos

Bart Oldeman wrote:

> On 10/29/06, Matthew Clarke <clamat@telus.net> wrote:
>> Sat, Oct 28, 2006 at 05:14:55PM -0700, Ralph Alvy may have written:
>>
>> > 84        -install)
>> > 85            INSTALL=1
>> > 86            if [ -n "$2" -a "${2:0:1}" != "-" ]; then
>> > 87              PROPRIETARY=$2
>>
>> If bash is installed as /bin/bash, you can change the first line of the
>> script to
>>
>>         #! /bin/bash
>>
>> to avoid the problem.
> 
> You could also replace line 86 by:
>             if [ -n "$2" -a -n "${2%%-*}" ]; then
> which is portable to Bourne sh AFAIK (and a better solution for dosemu
> itself -- some distributions don't like /bin/bash scripts).

Well, for me anyway, I think it's easier to remember to change the first
line to

        #! /bin/bash

whenever I see this problem arise, which is so rare to begin with (only one
disribution so far, among so many installed).


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-10-29 10:26       ` Bart Oldeman
  2006-10-29 17:08         ` Ralph Alvy
@ 2006-10-29 17:24         ` Ralph Alvy
  2006-10-30 11:08           ` Cristi Mitrana
  1 sibling, 1 reply; 17+ messages in thread
From: Ralph Alvy @ 2006-10-29 17:24 UTC (permalink / raw)
  To: linux-msdos

Bart Oldeman wrote:

> if [ -n "$2" -a -n "${2%%-*}" ]; then

I tried your substitution under Kubuntu 6.10. Two comments:

1. There's one more instance where the substitution must be made: line 98.

2. xdosemu loads fine, though there is one error message upon loading:

        [: 373: 0: unexpected operator



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-10-29 17:24         ` Ralph Alvy
@ 2006-10-30 11:08           ` Cristi Mitrana
  2006-10-30 21:14             ` Ralph Alvy
  0 siblings, 1 reply; 17+ messages in thread
From: Cristi Mitrana @ 2006-10-30 11:08 UTC (permalink / raw)
  To: linux-msdos

On 10/29/06, Ralph Alvy <ralph@ralphalvy.com> wrote:
> Bart Oldeman wrote:
>
> > if [ -n "$2" -a -n "${2%%-*}" ]; then
>
> I tried your substitution under Kubuntu 6.10. Two comments:
>
> 1. There's one more instance where the substitution must be made: line 98.
>
> 2. xdosemu loads fine, though there is one error message upon loading:
>
>         [: 373: 0: unexpected operator

[...]

That is because the new Ubuntu release uses dash instead of bash for
/bin/sh and hence all bash constructs are not supported.

-- 
mitu

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-10-30 11:08           ` Cristi Mitrana
@ 2006-10-30 21:14             ` Ralph Alvy
  2006-11-01  6:44               ` Cristi Mitrana
  0 siblings, 1 reply; 17+ messages in thread
From: Ralph Alvy @ 2006-10-30 21:14 UTC (permalink / raw)
  To: linux-msdos

Cristi Mitrana wrote:

> On 10/29/06, Ralph Alvy <ralph@ralphalvy.com> wrote:
>> Bart Oldeman wrote:
>>
>> > if [ -n "$2" -a -n "${2%%-*}" ]; then
>>
>> I tried your substitution under Kubuntu 6.10. Two comments:
>>
>> 1. There's one more instance where the substitution must be made: line
>> 98.
>>
>> 2. xdosemu loads fine, though there is one error message upon loading:
>>
>>         [: 373: 0: unexpected operator
> 
> [...]
> 
> That is because the new Ubuntu release uses dash instead of bash for
> /bin/sh and hence all bash constructs are not supported.
> 
Isn't that a rather severe change?


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-10-30 21:14             ` Ralph Alvy
@ 2006-11-01  6:44               ` Cristi Mitrana
  2006-11-01 18:01                 ` Mike McCarty
  0 siblings, 1 reply; 17+ messages in thread
From: Cristi Mitrana @ 2006-11-01  6:44 UTC (permalink / raw)
  To: linux-msdos

On 10/30/06, Ralph Alvy <ralvy@warpmail.net> wrote:
> Cristi Mitrana wrote:
[..]
> >
> > That is because the new Ubuntu release uses dash instead of bash for
> > /bin/sh and hence all bash constructs are not supported.
> >
> Isn't that a rather severe change?
>

 It is actually, since dash is just a minimal POSIX shell without all
the features that bash has it.
Any script that uses bash constructs should have #!/bin/bash at the
beginning instead of #!/bin/sh. It's more of an annoyance this days,
at least on linux, because bash is always available in any distro and
it is the default shell.

-- 
mitu

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-11-01  6:44               ` Cristi Mitrana
@ 2006-11-01 18:01                 ` Mike McCarty
  0 siblings, 0 replies; 17+ messages in thread
From: Mike McCarty @ 2006-11-01 18:01 UTC (permalink / raw)
  To: linux-msdos

Cristi Mitrana wrote:
> On 10/30/06, Ralph Alvy <ralvy@warpmail.net> wrote:
> 
>> Cristi Mitrana wrote:
> 
> [..]
> 
>> >
>> > That is because the new Ubuntu release uses dash instead of bash for
>> > /bin/sh and hence all bash constructs are not supported.
>> >
>> Isn't that a rather severe change?
>>
> 
> It is actually, since dash is just a minimal POSIX shell without all
> the features that bash has it.
> Any script that uses bash constructs should have #!/bin/bash at the
> beginning instead of #!/bin/sh. It's more of an annoyance this days,
> at least on linux, because bash is always available in any distro and
> it is the default shell.

Umm, I believe that all current releases of Linux have

$ ls -l /bin/sh
lrwxrwxrwx  1 root root 4 Oct 20  2004 /bin/sh -> bash

AND bash also behaves somewhat differently when invoked
as sh.

IMO, use of bash-specific features in released scripts is
a bad idea, anyway. It results in extra maintenance.

Mike
-- 
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-10-28  3:32 Syntax error: Bad substitution Ralph Alvy
                   ` (2 preceding siblings ...)
  2006-10-28 22:56 ` Matthew Clarke
@ 2006-11-08 16:23 ` Ralph Alvy
  2006-11-08 18:28   ` Bart Oldeman
  3 siblings, 1 reply; 17+ messages in thread
From: Ralph Alvy @ 2006-11-08 16:23 UTC (permalink / raw)
  To: linux-msdos

Ralph Alvy wrote:

> I'm getting the following error when running dosemu 1.2.2 under a newly
> installed Kubuntu 6.10:
> 
> ./xdosemu: 86: Syntax error: Bad substitution
> 
> What might be going on here?

I noticed this comment on a Web page about compiling kernels with Ubuntu
6.10 (http://www.howtoforge.com/kernel_compilation_ubuntu). Pretty much
sums up the problems outlined in this thread:

--- quote follows ---

On Ubuntu 6.10, /bin/sh is a symlink to /bin/dash by default. /bin/dash
seems to make problems when you compile software from the sources, at least
I had that impression. That's why I make /bin/sh a symlink to /bin/bash
instead.

If you are on Ubuntu 6.10, you should do this now:

rm -f /bin/sh
ln -s /bin/bash /bin/sh


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-11-08 16:23 ` Ralph Alvy
@ 2006-11-08 18:28   ` Bart Oldeman
  2006-11-08 20:07     ` Ralph Alvy
  0 siblings, 1 reply; 17+ messages in thread
From: Bart Oldeman @ 2006-11-08 18:28 UTC (permalink / raw)
  To: Ralph Alvy; +Cc: linux-msdos

On 11/8/06, Ralph Alvy <ralph@ralphalvy.com> wrote:

> --- quote follows ---

> If you are on Ubuntu 6.10, you should do this now:
>
> rm -f /bin/sh
> ln -s /bin/bash /bin/sh
>

There are still advantages in using dash over bash, e.g. scripts are
executed faster that way. As for the remaining dosemu warning you got,
replacing
$UID
by
`id -ur`
in the dosemu script should fix that.

Bart

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Syntax error: Bad substitution
  2006-11-08 18:28   ` Bart Oldeman
@ 2006-11-08 20:07     ` Ralph Alvy
  0 siblings, 0 replies; 17+ messages in thread
From: Ralph Alvy @ 2006-11-08 20:07 UTC (permalink / raw)
  To: linux-msdos

Bart Oldeman wrote:

> On 11/8/06, Ralph Alvy <ralph@ralphalvy.com> wrote:
> 
>> --- quote follows ---
> 
>> If you are on Ubuntu 6.10, you should do this now:
>>
>> rm -f /bin/sh
>> ln -s /bin/bash /bin/sh
>>
> 
> There are still advantages in using dash over bash, e.g. scripts are
> executed faster that way. As for the remaining dosemu warning you got,
> replacing
> $UID
> by
> `id -ur`
> in the dosemu script should fix that.
> 
> Bart

I ended up just replacing 

        #! /bin/sh

with 

        #! /bin/bash

Seemed like the easiest thing to do.


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2006-11-08 20:07 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-28  3:32 Syntax error: Bad substitution Ralph Alvy
2006-10-28  6:22 ` Ralph Alvy
2006-10-28 16:57 ` Ralph Alvy
2006-10-28 22:56 ` Matthew Clarke
2006-10-29  0:14   ` Ralph Alvy
2006-10-29  0:41     ` Matthew Clarke
2006-10-29  1:17       ` Ralph Alvy
2006-10-29 10:26       ` Bart Oldeman
2006-10-29 17:08         ` Ralph Alvy
2006-10-29 17:24         ` Ralph Alvy
2006-10-30 11:08           ` Cristi Mitrana
2006-10-30 21:14             ` Ralph Alvy
2006-11-01  6:44               ` Cristi Mitrana
2006-11-01 18:01                 ` Mike McCarty
2006-11-08 16:23 ` Ralph Alvy
2006-11-08 18:28   ` Bart Oldeman
2006-11-08 20:07     ` Ralph Alvy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox